04-04-2012 07:37 AM
Firstly, its probably better if i put my understanding about Arrays on the table in terms of its visual functions.
When i create a 1D array constant, it looks like I can choose to grow it in a horizontal or vertical manor. So does this mean it can either be 1 row of n columns for horizontally, or 1 column of n rows if I chose to grow the elements downward?
My confusion came from a CLAD question re array size, whereby the explanation was that you count rows first then columns. But whats not clear to me, is if you can alter (i guess) the orientation of an array., so the rows become columns! as this is how it looks to me My further confusion comes when I add a 2nd dimension, im unsure if im growing rows or colums, with respected to how i intially grew it, vertically/horizontally
Sorry for the daft question!
04-04-2012 07:47 AM
Hi
I like this question. But, I am not sure if I can answer this 'technically' in a correct way. I can tell you how I understand it.
When we talk about 1D arrays in LabVIEW, as you mentioned, we may theoretically see them as a mathematical array of size 1*n or n*1 depending on how you expand it visually. However, the array functions for 1D array do not identify any rows or cloumns. They are just a number of identical elements grouped into a single entity.
When we talk about 2D arrays in LabVIEW, they are similar to mathematical matrices, with rows and columns and you can perform the functions on either rows, columns, or cells identified by a set of (row,column). In this case, the horizontal elements form a row, the vertical elements form a column.
04-04-2012 07:57 AM
Visually, it doesn't matter if you grow a 1D array control/constant in the horizontal or vertical direction. This freedom is simply a part of the graphical manner in which the array is presented and does not affect the array itself. A 1D array does not have more than one dimension, you are simply choosing to display it either widthways or stacked.
04-04-2012 07:57 AM
A 1D array has no rows or columns, so that terminology is moot when it pertains to 1D arrays. The growing business on the front panel is for a human's benefit. Depending on the data, it might make more sense to see it vertically, or it might make more sense to see it horizontally (e.g., if it's an array of bits). That does not create "rows" or "columns" for the 1D array, however.
"Rows" and "columns" are a human perception. The "rows" and "columns" with 2D arrays pertain to the dimensions of the array (and how the data is stored in memory). It also pertains to what order the elements are peeled off when autoindexing. It also pertains to how an array is built when using Build Array. In this matter you do "rows" first. Technically, however, you're really referring to doing the first dimension first. You could transpose the array and then rows become columns.
04-04-2012 08:18 AM
Thank you Gents, this had cleared it up for me : -)
04-04-2012 08:46 AM
Actually, after trying something out there, and a challenge to your response, smercurio_fc : -), it would appear that LabVIEW actually treats a 1D array as a row? As if i grow my array vertically downwards in a “perceived” Colum, then add another dimension, LabVIEW automatically reverts my “perceived” 1d column into a row. When i try this the opposite way, it remains as a “row”
04-04-2012 09:35 AM
@labnoob wrote:
Actually, after trying something out there, and a challenge to your response, smercurio_fc : -), it would appear that LabVIEW actually treats a 1D array as a row? As if i grow my array vertically downwards in a “perceived” Colum, then add another dimension, LabVIEW automatically reverts my “perceived” 1d column into a row.
That's not an implication that 1D arrays are rows or columns. They are neither. When you add a dimension you're turing it intoa 2D array. 2D arrays are filled by "rows" first. Thus the elements of the 1D array become the first "row" of the 2D array.
When i try this the opposite way, it remains as a “row”
That's a visual thing because a 2D array is rectangular, visually. When you remove a dimension you're removing the "columns" and left with the first "row" of the 2D array.
04-04-2012
09:57 AM
- last edited on
01-28-2025
09:49 PM
by
Content Cleaner
Unlike some other programming environments (MathScript, matlab, scilab, etc.), LabVIEW makes no distinction between column vectors and row vectors, they are all just 1D arrays.
Similar to what they say about Las Vegas: What happens on the front panel, stays on the front panel. The cosmetic "orientation" of the array container is invisible to the algorithm using the array on the diagram.
All that said, if you need to make a distinction about row vs. column vectors for linear algebra calcuations, you need to create either a 1xN or a Nx1 2D array.
The word "matrix" has been mentioned. In LabVIEW, a matrix is not the same as a 2D array. A matrix is a special datatype that is similar to a 2D array, but will potentially select a different polymorpic instance when wired as imput to certain operations, especially in linear algebra. Don't mix up the two (more information). Matrices need to be floating point or complex, while 2D arrays can be of any data type.