LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with indexing arrays.

Hey I'm having some issues with indexing arrays.
 
I have this VI here, That reads a text file with tabs and carrige return delimiting.
 
The array is read properly, but I'm having trouble picking the whole array apart.
 
(on page 3 of the stacked sequence)
 
I'm using the FOR LOOP and trying to pick off one ROW per iteration. So during iteration 0 it would read row 0 , and so on.
 
I would like to pop each one of the 4 values in a row out so I can manipulate them individually.  
 
With this VI right now I get the spreadsheet displayed correctly as the output  of the read from spreadsheet file, but in the FOR LOOP, all of my values are zero.
 
What did I do wrong?
 
 
0 Kudos
Message 1 of 9
(3,035 Views)
Hi Vr6Fidelity
i can´t test it because i have not your rtf file. You don´t need to connect a loop counter if you connect an Array with indexing. The loop counter has priority.
How do you test if all elements are 0? Could it be that only the last element is 0?
 
Another thing is, that you read the first element of row 0, the second element of row 1, ... and so on.
 
Mike


Message Edited by MikeS81 on 02-11-2008 02:41 PM
0 Kudos
Message 2 of 9
(3,031 Views)

Ok here is a sample RTF file, I use this one so I know what cell im looking at.

The actual numbers are of high precision and will look like this: -2.0000008 (7 digits after the decimal place and one before.)

 

 

0 Kudos
Message 3 of 9
(3,027 Views)
On LV 8.5 the Read From Spreadsheet file does not like RTF files. When I created a plain text file from the data I get 8 rows and 2 columns.

After two rows you will be indexing empty columns, which I think returns the default value for the datatype = zero.

If your real data has 8 rows and 4 columns, and you want the four column values for a given row, then you want the indexes to be fixed at 0,1,2,3. I don't recall whether your version of LV automatically incremented index values on the Index Array function or whether you need to do it explicitly.

As mentioned in a previous post, do not connect anything to N when using autoindexing tunnels.

Lynn
0 Kudos
Message 4 of 9
(3,014 Views)

Hi Vr6Fidelity

i simpliefied your vi to test it with your provided rtf file. see the changes, please. Is this what you want?

Mike

0 Kudos
Message 5 of 9
(2,994 Views)

Thanks for the help.

However, I don't really understand with your VI

a. How it works

b. how do i use the individual elements?

 

0 Kudos
Message 6 of 9
(2,981 Views)
Also this is for LV 6.1 but I have thru V8 here.
0 Kudos
Message 7 of 9
(2,980 Views)

Hi Vr6Fidelity

  1. it reads the rtf file and in the for loop i take the first value of each row, this value is then visible in the element indicator
  2. for seeing all selected values i build a new array of it
  3. i have saved the vi for LV Version 8.0

What do you want to do with this values?

Mike



Message Edited by MikeS81 on 02-12-2008 07:38 AM
0 Kudos
Message 8 of 9
(2,976 Views)
I figured it all out, Ill post it up when im done.
0 Kudos
Message 9 of 9
(2,959 Views)