Return array from function
liwenna
liwenna at gmail.com
Mon Dec 12 10:57:09 UTC 2011
Must admit that I do not understand the code but I do happen to know
that array's start counting levels at 0, so the "top left" cell in a
3*3 array is U(0,0) and the bottom right U(2,2). => if you let i and j
run from 0 to 2 rather than 1 to 3, that may help?
best,
liw
On Dec 12, 11:48 am, ELine <elin... at hotmail.com> wrote:
> Hello again
>
> I have problems returning a 3x3 array from a function. I have an
> experiment with 9 conditions and to keep things simple I organized
> them in a 3x3 array. I want to keep track on the number of trials pr
> condition by updating this array in the end of each trial using a user-
> specified function that returns a 3x3 array containing one 1 (rest is
> 0s) specifying which trial has been run.
>
> my problem is not with the function itself, but with returning a 3x3
> array. I've tried something like this (but of course more
> complicated):
>
> Function UpdateArray(A As Integer, B As Integer) As Variant
> Dim U(3,3) As Variant
>
> for i= 1 to 3
> for j= 1 to 3
> U(i,j)=0
> next j
> next i
> U(A,B)=1
>
> UpdateArray=U
>
> End Function
>
> When compiling E-Prime returns the error: Cannot assign whole array. I
> also tried with integer instead of variant, but it still doesn't work.
> And I've tried including ReDim, but without any luck.
>
> Can anyone help me?
>
> ELine
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.
More information about the Eprime
mailing list