Matrix columns and how to equate them to vectors
dcnicholls
Make/N=(10,3)/D a // setting up a matrix 'a' with 10 rows and 3 columns<br />
Make/N=10/D b // seting up a 10-row vector 'b'<br />
b={1,2,3,4,5,6,7,8,9,0} // set b values<br />
print b<br />
b[0]= {1,2,3,4,5,6,7,8,9,0}<br />
a=0<br />
print a<br />
a[0][0]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][1]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][2]= {0,0,0,0,0,0,0,0,0,0}<br />
a[][0]=b // set first column of a to equal b<br />
print a // which works as expected<br />
a[0][0]= {1,2,3,4,5,6,7,8,9,0}<br />
a[0][1]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][2]= {0,0,0,0,0,0,0,0,0,0}<br />
<br />
a[][1]=b // try to set the second column of a to equal b and...<br />
print a<br />
a[0][0]= {1,2,3,4,5,6,7,8,9,0}<br />
a[0][1]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][2]= {0,0,0,0,0,0,0,0,0,0}<br />
Make/N=10/D b // seting up a 10-row vector 'b'<br />
b={1,2,3,4,5,6,7,8,9,0} // set b values<br />
print b<br />
b[0]= {1,2,3,4,5,6,7,8,9,0}<br />
a=0<br />
print a<br />
a[0][0]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][1]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][2]= {0,0,0,0,0,0,0,0,0,0}<br />
a[][0]=b // set first column of a to equal b<br />
print a // which works as expected<br />
a[0][0]= {1,2,3,4,5,6,7,8,9,0}<br />
a[0][1]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][2]= {0,0,0,0,0,0,0,0,0,0}<br />
<br />
a[][1]=b // try to set the second column of a to equal b and...<br />
print a<br />
a[0][0]= {1,2,3,4,5,6,7,8,9,0}<br />
a[0][1]= {0,0,0,0,0,0,0,0,0,0}<br />
a[0][2]= {0,0,0,0,0,0,0,0,0,0}<br />
What is happening and how do I equate random columns in a matrix to a 1-D vector with the same number of rows?
This is most puzzling. The Manual is immensely detailed but (maybe as a consequence) I cannot find an explanation on how Igor indexes arrays, which might explain what's happening.
DN
I think this is what you want to do.
THere is something in the help file that describes this kind of wave assignment. Try typing:
in the command line.
BTW you can create a wave like this:
or you could try:
b[] = p //which won't do exactly the same thing.
December 1, 2010 at 03:21 am - Permalink
December 1, 2010 at 12:12 am - Permalink