|
Re: Help with FOR ...DO BEGIN..........I'M A BEGINNER, begging for some help!!!!! [message #81983 is a reply to message #81980] |
Sat, 03 November 2012 14:42  |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
On Sat, 3 Nov 2012 14:30:14 -0700 (PDT), Marta wrote:
> Hi,I'm Marta sorry if this is not the right place to write!!!My problem is:
> I've got 4 one row numer arrays of different lenghth
> A = [1,2,3]
> B = [4,5,6,7]
> C = [8,9,10]
> D = [11,12,13,14]
> I want to do this operation:
> -pick first element of A,1,and the first element of C,8, then calculate (1-4)+(8-11),(1-5)+(8-12),(1-6)+(8-13),(1-7)+(8-14).
> them pick the second element of A, the second element of C and do it again...
> at the end put all results in a file.........
>
> Thank you for theattention and eventually for help! (my english is not very good)
Hi Marta,
you can do this:
first=(a[0]-b)+(c[0]-d)
second=(a[1]-b)+(c[1]-d)
or, if you want to have all results within one array:
result=intarr(4,3)
for i=0,2 do result[0,i]=(a[i]-b)+(c[i]-d)
Cheers, Heinz
|
|
|