LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you find the size of a two dimensional array in mathscript?

I think when I ask for the size of it I get it's length in the verticle direction, but I couldn't figure out how to get its horizontal length.
 
Also, when I made a new array out of one row of the two dimensional array, I can't find the size of that either.
 
Adam
0 Kudos
Message 1 of 4
(8,661 Views)
Hello,

What command are you using to get the size of a two-dimensional array?  Size or length?  The length command will return the number of rows or the number of columns of a matrix, whichever is larger.  This might explain your first problem.  If you use the size command, it will return a vector.  The first element is the number of columns and the second element is the number of rows.  For more information about using either of these commands, you can type
help size
help length

in the MathScript Window.

If you create a row vector by indexing a row of the matrix, you should be able to use either size or length to determine the size of the vector.  Can you provide some sample code that exhibits the difficulty you see in computing the size?

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 2 of 4
(8,655 Views)

Hi Adam,

the attached VI illustrates what you are trying to achieve.  It displays the dimensions of a 2-D array and then it extracts a 1-D subset array and also outputs the new dimensions.

Thanks,

KostasB

National Instruments

Applications Engineering 

Message 3 of 4
(8,490 Views)
Thank you, both of you. I appreciate it.

0 Kudos
Message 4 of 4
(8,479 Views)