Re: newbie: array passing problem
- From: dpb <none@xxxxxxx>
- Date: Sat, 14 Jul 2007 15:05:56 -0500
Mike Williams wrote:
"tom" <tadamsmar@xxxxxxxxx> wrote in message news:1184350761.343721.274120@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxCan I pass a one dimension of an array as an array?
For instance:
DIM A(5,3) as Single
CALL FUBAR(A(1,2))
SUBROUTINE FUBAR(X() as Single)
Can X be treated as on dimensional array with 5 elements?
I'm not quite sure what you mean there, but if you want to perform some task on specific "column" (or "row" depending on how you look at things) of a two dimensional array then you can do so in the following manner. You can see immediately that it does not require any shifting about of actual array memory (because the array is passed by reference) by the fact that even though the entire array contains 25 million elements the 5000 elements in the specified "column" are deal with almost immediately you press the button. Unless of course I've misunderstood your question.
I think you have, Mike (misunderstood the question, that is :) )...
In your example code you're still always addressing the array w/ both subscripts.
In older FORTRAN, it was often the case that subroutines were passed the address (as they are in VB) of the starting array location and in the subroutine a multiply-dimension array would then be referenced by only a single index. OP wanted to implement that same construction in VB directly if possible as he was trying to translate code on a direct line-by-line basis. VB, however, won't allow the inconsistent array dimensions.
Parenthetically, newer Fortran introduces "array slices" which allow the same thing but are "safer" in that they contain the additional dope vector that allow the compiler to do bounds checking, etc., if requested that wasn't always possible w/ the earlier (pre-F77) versions.
--
.
- Follow-Ups:
- Re: newbie: array passing problem
- From: Mike Williams
- Re: newbie: array passing problem
- References:
- newbie: array passing problem
- From: tom
- Re: newbie: array passing problem
- From: Mike Williams
- newbie: array passing problem
- Prev by Date: Re: set text file extended property
- Next by Date: Re: Converting a csv file...
- Previous by thread: Re: newbie: array passing problem
- Next by thread: Re: newbie: array passing problem
- Index(es):