LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert into specific cell in an array?

Maybe a dumb question...
 
I have a two for loops running... where im basically pulling 7 sets of data for three different criterias in which I would end up with a 21 cell multicolumn listbox. If I want to insert data into specific cells of that listbox..how do I go about doing that?
 
I figured id just wire in the counters from both loops for the index of my row and column into the insert into array function, but that only allows you to specify one index at a time... is there anyway to do this task? 
0 Kudos
Message 1 of 4
(3,495 Views)
I don't think I understand. The multicolumn listbox ItemNames property is a 2D array. If you wire a 2D-array to the insert into array function it accepts 2 indices (row and column). So your thought (using the loop counters) should work.

EDIT: if you wire both indices (row and column) the data to insert must be a simple string (no array). If you wire just one index, you're inserting a complete row/column and you'll have to insert an array.

Message Edited by dan_u on 05-24-2007 05:04 PM

0 Kudos
Message 2 of 4
(3,484 Views)
Sorry, the above is wrong. I was thinking about the replace array subset function as this is the one you should use.
Initialize the array with the expected size (7x3). In the for loops, just replace the element you want, wiring both indices.
0 Kudos
Message 3 of 4
(3,478 Views)
You have to be a bit careful with the nomenclature.
 
There is a big difference between "Insert into array" and "replace array element" (what you really want.
 
The insert into array function "grows" the array. In the case if a 1D array, the output will be larger by the size of the inserted part. In the case of a 2D array, you add entire rows/columns.
 
You have a fixed size array and want to replace the current content of a cell (e.g. "empty string") with a new value. Here's one possibility:
 
 
 
 
 

Message Edited by altenbach on 05-24-2007 09:06 AM

0 Kudos
Message 4 of 4
(3,469 Views)