LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

replace 1 col from 2D array problem

I am try to replace a col from 2d Array or insert element to a col into 2D array. I have this little program, but I can not make it work. The replacement does not happen. Please help?
0 Kudos
Message 1 of 5
(2,889 Views)
Hi,
There is a function - Replace array subset, that directly replaces a cloumn in a 2D array.
 
Check atachment,
Hope it helps,
Paulo
0 Kudos
Message 2 of 5
(2,887 Views)

Thank you for reply.

Actually I want to find the data from first col to 9th col to match a file name, this file name consists of the info of col 1-9 of this array, just seperate by "-". If it find the right row, it will append string "Level" in the same row (the 16th col).

It is strang I can not append to 16th col, possibly there is an array size issue. I tried hard but, my brain is dead now, please help?

0 Kudos
Message 3 of 5
(2,877 Views)
See attached vi.  I found several things wrong.  You have two spaces before the 1 in column 4 (starting with 0), and you had one space before trf in column 6.  In your matching string there were no spaces.  I adjusted the matching string to contain the necessary spaces.    Also, you have to skip the first row (row 0) because it contains titles and not data.  I have added how to convert the matching string to an array, and how to check the matching array to each row in the big array.  I think it now works as you expect.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 5
(2,869 Views)


@detech wrote:

It is strang I can not append to 16th col, possibly there is an array size issue. I tried hard but, my brain is dead now, please help?


You are not appending, you are replacing array elements. Your array only has 16 columns (0..15), thus there is nothing to replace in column 16. You need to grow the array by one column to operate on colum 16.

I would suggest you rattle through the rows using autoindexing, search for a match, then add the desired element, building an new output array. It is not very efficient to rewrite the entire array at each iteration with a property node!

Note also that your compare string will never match, because your date has "\" instead of "/" as separator and your NMC must be upper case.

Attached is one possible solution (LV7.1), modify as needed. (Don't rewrite the original array, or it will grow by one every time you run it!

Message Edited by altenbach on 07-27-2005 03:04 PM

0 Kudos
Message 5 of 5
(2,865 Views)