LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing Arrays

All,
 
I am new using boards.  Thanks for all your help.
 
Please see the attached vi for my problem.  I am opening a comma seperated file, reading it into an array then want to sort through the data.
 
I want to review each row of the array and only pick out the rows that have a value of "VOLT" in the first element of the row. 
 
I want to take each row found and create a new array of only rows that have "VOLT" in the first element. 
 
The attached vi runs but my target array remains empty reguardless of how i approch it.
 
Any help would be greatly appreciated.
 
 
Thanks,
 
0 Kudos
Message 1 of 10
(3,641 Views)
Is VOLT the only thing contained in the first element?  Or is it something like VOLT=1.23 or VOLT:8.45? This affects how the parsing could be done.  If you could post a sample file it would help get you an answer quicker.

Paul
0 Kudos
Message 2 of 10
(3,630 Views)
Here is a  watered down sample of my data
0 Kudos
Message 3 of 10
(3,624 Views)
This should work for you.  I modified the intial state as it looks like your using a custom menu.  I also seperated out the header row.  also your file was tab delimited, not comma delimited.  Not sure if that was on purpose.  Post any questions. good luck

Message Edited by Stradis on 08-26-2007 07:54 PM


Paul
0 Kudos
Message 4 of 10
(3,619 Views)
Thanks for all you help.
 
 
John
0 Kudos
Message 5 of 10
(3,612 Views)
guess it worked for you. great!

Paul
0 Kudos
Message 6 of 10
(3,609 Views)


John@Saft wrote:
I am opening a comma seperated file, ...
Your sample file is tab separated. Here's a quick way to read it and extract the rows containing VOLT in the first column.
0 Kudos
Message 7 of 10
(3,603 Views)
altenbach,
Your solution is very concise, yet inefficient in this application, you are parsing every single line, and if I understand what he did, it is a pretty huge datafile.  No need to check every line... although that approach is similiar to what I had used if there was something combined with the VOLT in the first row.  Which was why I asked aout that in the first place

Paul
0 Kudos
Message 8 of 10
(3,597 Views)


@Stradis wrote:
Your solution is very concise, yet inefficient in this application, you are parsing every single line, and if I understand what he did, it is a pretty huge datafile. 

I don't like to discuss performance without any real benchmarks on big files, but you could be right. 🙂

However, if only the VOLTS lines are needed at the end, the "string to spreadheet array" will create a gigantic 2D array. Maybe it would be faster to search the raw string for the VOLTS lines only. Just an idea that might be worth benchmarking. 🙂

Seems to reduce the problem by about a factor of 30.


Message Edited by altenbach on 08-26-2007 05:56 PM

Download All
0 Kudos
Message 9 of 10
(3,571 Views)
That is a very true statement. parsing the raw string makes more sense than anything.  Then if we step back, and understand the application even more, we may ask why the heck are we saving so much extra info? but It seems he is satisfied for now.

Paul
0 Kudos
Message 10 of 10
(3,565 Views)