Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

VBA to Fortran question

rahzan
New Contributor I
473 Views

To send a bunch of data from ms-excel to Fortran it must be cast into anarray of the right type.

e.g.
---------------
Dim X() as double: Redim X(1 to n, 1 to m)
For j=1 to m
For i=1 to n
X(I,j)=sheets("Sheet1").range("A1").offset(I,j)
Next:
Next

Stepping through the code it is MUCH faster to say:

X = Sheets("Sheet1").range("A1").resize(nRows, nCols)

with (I assume) X as a variant array because itdoes not need to be declared.

Now the first choice takes much longer than the second. But only VBA understands the second to be an array

1. Either this is a zero sum game and the second choice just picks up a pointer and later when X is accessed in VBA the memory-access delay occurs. OR....

2. The second choice really is faster, in which case, I would like to know:

Is there a way to pass the second X to a F90 DLL?

Thanks a bushel.

0 Kudos
1 Reply
anthonyrichards
New Contributor III
473 Views
0 Kudos
Reply