Return array from function

ELine elinebp at hotmail.com
Mon Dec 12 10:48:22 UTC 2011


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