Wave Indexing
Ken
I know that it is possible to do the following given that TestWave is a 3 rows by 2 columns wave:
TestWave[0] = 100 (sets all elements of the first row to 100)
TestWave[0] = {100,200,300} (sets first row, first column to be 100, second row, first column to be 200, and third row, first column to be 300)
However, I have not found a way to declare an entire row at a time, such as if I want to declare the first row to be 100, 200, 300. The only way to do that seems to be TestWave[0][0] = 100; TestWave[0][1] = 200; TestWave[0][2] = 300. This method becomes unrealistic when TestWave has more columns. Is there syntax in Igor Pro that allows you to do the same thing without having to declare each element separately?
Thank you.
TestWave[0][] = 100 + q*100
See the "Waveform Arithmetic and Assignment" help topic.
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
June 17, 2011 at 02:33 pm - Permalink
You should read up about p, q, and r as index values in multi-dimensional waves. Then, play with this example via a line-by-line execution at the command line.
testwave[][] = (p+1)*100
testwave = 0
testwave[][] = (q+1)*100
testwave = 0
testwave[0][] = (p+1)*100
testwave = 0
testwave[0][] = (q+1)*100
testwave = 0
testwave[][0] = (p+1)*100
testwave = 0
testwave[][0] = (q+1)*100
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
June 17, 2011 at 02:40 pm - Permalink
mat[][0] = 55 // Set all rows, column zero
mat[0][] = 33 // Set row 0, all columns
Think of [] as meaning "all" of the dimension corresponding to its position in the destination expression (e.g., "all rows" or "all columns").
June 17, 2011 at 03:41 pm - Permalink
The function below works but throws an error ("While executing a wave read, the following error occurred: Index out of range for wave 'subSection'".)
make/o/n=(10,10,100) subSection = 1
make/o/n=(100,100,100) bigMatrix = 0
bigMatrix[20,29][20,29][] = subSection[p][q][r]
end
October 7, 2016 at 02:22 am - Permalink
make/o/n=(10,10,100) subSection = 1
make/o/n=(100,100,100) bigMatrix = 0
bigMatrix[20,29][20,29][] = subSection[p-20][q-20][r]
end
Regards,
Kurt
October 7, 2016 at 02:41 am - Permalink
Thanks!
October 7, 2016 at 02:49 am - Permalink