Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default how to send a variable size VBA array to a C struct

In VBA I can create a user defined Type that contains fixed size
arrays, and pass one of these to a C DLL where it goes into a struct,
if the struct was compiled with the correct array sizes ahead of time.

Is it possible to do this with variable size arrays?

Thanks,

Brian Murphy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default how to send a variable size VBA array to a C struct

You can use MALLOC function at 'C' to have a variable size of
structure.



On Apr 28, 7:56*am, Brian Murphy wrote:
In VBA I can create a user defined Type that contains fixed size
arrays, and pass one of these to a C DLL where it goes into a struct,
if the struct was compiled with the correct array sizes ahead of time.

Is it possible to do this with variable size arrays?

Thanks,

Brian Murphy


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default how to send a variable size VBA array to a C struct

Brian - off topic, i saw a thread from you a while ago about how
Excel calculates smooth curves and created a few formulas and
simplified code, with good results. See links in this thread:
http://help.lockergnome.com/office/d...ct1005590.html

The values are the same as yours in general but the correction
factor differs slightly. I'm pretty sure this adjustment is exact.and
has a natural interpretation in terms of tangent conditions. I'm
also fairly certain Excel uses de Casteljau's algorithm to calculate
the curve with straight lines joining the calculated points.

"Brian Murphy" wrote in message
...
In VBA I can create a user defined Type that contains fixed size
arrays, and pass one of these to a C DLL where it goes into a struct,
if the struct was compiled with the correct array sizes ahead of time.

Is it possible to do this with variable size arrays?

Thanks,

Brian Murphy



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default how to send a variable size VBA array to a C struct


I will be sending data from Excel to C, so I want to allocate the
arrays in VBA .

Are you saying that I still ought to use MALLOC in the C code to
create space for the arrays?

Brian


On Apr 28, 12:37 am, dk wrote:
You can use MALLOC function at 'C' to have a variable size of
structure.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default how to send a variable size VBA array to a C struct


Dear Lori,

That's very interesting. I'll confess I actually haven't looked at
this in quite a while.

I just read what Wiki says about Catmull Splines. It looks like that
uses central difference to get the slopes. I don't remember what bits
of logic I had implemented for my spline.

I tried to use your IRR cell formula but only got #N/A out of it. So
I couldn't compare it to what my function returns. If you have a
workbook that shows a comparison, you can send it to me if you wish.
What "issues" with my function does your solution resolve?

Brian





On Apr 28, 1:28 am, "Lori Miller"
wrote:
Brian - off topic, i saw a thread from you a while ago about how
Excel calculates smooth curves and created a few formulas and
simplified code, with good results. See links in this thread:http://help.lockergnome.com/office/d...ct1005590.html

The values are the same as yours in general but the correction
factor differs slightly. I'm pretty sure this adjustment is exact.and
has a natural interpretation in terms of tangent conditions. I'm
also fairly certain Excel uses de Casteljau's algorithm to calculate
the curve with straight lines joining the calculated points.

"Brian Murphy" wrote in message

...

In VBA I can create a user defined Type that contains fixed size
arrays, and pass one of these to a C DLL where it goes into a struct,
if the struct was compiled with the correct array sizes ahead of time.


Is it possible to do this with variable size arrays?


Thanks,


Brian Murphy




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default how to send a variable size VBA array to a C struct

I tried to use your IRR cell formula but only got #N/A out of it.

Maybe try changing -1 to 1 in the last match arguments?
The spline formula agrees with the Excel curve in many
practical situations. It won't match if the data spacing is
too irregular however - given four consecutive points
A,B,C,D then to apply in the interval BC, two conditions
must hold: |BC|<3|AC| and |BC|<3|BD| (in chart units.)


What "issues" with my function does your solution resolve?


The scaling adjustment can differ slightly in small intervals
and near endpoints - see example. The simplification comes
as you don't need the actual pixel lengths for the chart
scaling factor only ratios i.e. plot area width/length. My
UDF reads chart values so you'll need to update by pressing F9.

Example: In your smooth_curve_bezier_example file entering:

X Y
9 10
9.5 12
10 12
12 7

http://wikisend.com/download/544426/...ample_file.xls

BTW I think the ChartTool Utility is a great tool.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Anything like STRUCT in VBA? NateBuckley Excel Programming 5 June 2nd 08 05:16 PM
How to use function that returns array of variable size? [email protected][_2_] Excel Programming 3 February 13th 06 08:37 PM
Define an array with variable size Yiu Choi Fan Excel Programming 3 July 9th 04 11:29 AM
How to find out the size of a variable-size array ? Adrian[_7_] Excel Programming 1 July 6th 04 09:12 AM
Emulate C/C++ struct in VBA? No Name Excel Programming 8 January 8th 04 08:24 PM


All times are GMT +1. The time now is 11:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"