LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert element in selected column of 2d array

Hello
     How to insert value in selected column of an array
In my program i am reading the CAN data from channels using
CAN read Channel API, the recent data read from the CAN channels
will be displayed in the indicator "Channel Data" 1D array, the
size of array depends on the number of channel selected for
monitor. i want to save all channel data.
i want to insert the first element of "Channel Data" array to
first column of "All Channel Data" 2D array, the second element
to the second column of 2D array...
i attached my VI
how to do this give me an idea.
thanks
sk

I am using LabVIEW 7.1
0 Kudos
Message 1 of 3
(3,321 Views)
For 2D arrays, you must insert entire rows or columns at one time.  You cannot insert just one element.  Why?  Lets say for example you have a 2 x 3 array (2 rows with 3 columns).  If you insert an element in row 3 (a new row) column 1, what goes into columns 2 and 3?  You just messed up the integrity of the array, and Labview doesn't allow that.  What you need to do is gather data for all columns in the new row and insert the entire row.  The Insert Into Array function is used with the row number wired to Row Index and nothing wired to column index.  You can gather all your data, build a 1D array and insert that array into a new row in the 2D array.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 3
(3,307 Views)
As a different approach, you might select the particular row you wish to insert the data into with "Array subset", and then insert your specific element in the 1D array outputted from "Array Subset".  From there, use "Replace Array Subset" to re-insert the 1D array into the proper position in the 2D array.
0 Kudos
Message 3 of 3
(3,300 Views)