LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Select (and plot to xy graph) colums in text file delimited with blanks

Hello to you all,

 

again I have a problem: I would like to read out some colums of the attached ASCII file (Differential Touchstone file, first column is frequency)

to check whether a value is above a maximum value.

 

(For examle I must check the fourth column values (this is the absolute value of the differential transmission parameter (S21)) are greater -6 dB from 0-5 GHz, which is true in the example file.)

 

Therefore I need the colums separated ( also for plotting it in x/y graph).

 

Attached please find the file and the little vi I tested with.

 

I appreciate any help !

 

Best regards,

Bortoba

Download All
0 Kudos
Message 1 of 11
(2,876 Views)

You need to get rid of the first row and coloum.

 

This vi I use the array subset vi to do that.

 

 

Tim
GHSP
0 Kudos
Message 2 of 11
(2,872 Views)

Hi aeastet,

 

good idea, but how can I isolate only one column of the file ? Please note that there are different numbers of blanks between the values !

 

And why is the value, for example  -0.094502, displayed as 0 in the table  ?

 

Best regards,

B.

0 Kudos
Message 3 of 11
(2,867 Views)

It's displayed as 0 because there are only 7 spaces separating that value from the previous number, and you told the Read From Spreadsheet File to use 8 spaces as the delimeter. This is the flaw in using a variable number of spaces to separate column. Why is this even being done this way? So it lines up nicely in a text editor? What is this, 1980? If you have a variable number of columns like that then you need to read the file as lines and then iterate each line and use the Scan From String function. See attached for a simple example.

 

I also have no idea why you have the read inside a loop.

0 Kudos
Message 4 of 11
(2,856 Views)

Thank you.

I dont know, but true is :This is Tektronix Iconnect output from the S-parameter wizzard from 2011 Version !

 

Two more Qs: How can I then separate one column and how can I save it separated by , maybe Tab ?

 

many thanks so far !

 

B.r.

B.

 

 

 

 

0 Kudos
Message 5 of 11
(2,850 Views)

I don't understand your question. Are you asking how to pull out a column after you've read the file? Index Array.

 

As to the other question: Ask Tektronix, since their software generated that file. Or, you could pull it into a text editor or Excel and convert it yourself.

0 Kudos
Message 6 of 11
(2,841 Views)

Altought not optimized the following code will probably do want you want. The trick is to remove the header part of the file and then convert the rest of the file to a 2D-array. By the way, values in the range 4.19 to 4.22GHz of your file are below -6dB. You can modify the code to also add a start frequency, to display the frequencies that fail the comparison, ...

 

Ben64

0 Kudos
Message 7 of 11
(2,836 Views)

@ben64 wrote:

Altought not optimized


Well, that's a bit of an understatement. Smiley Surprised We could do all of what you're suggesting ....

 

 

... or, we could simply do what I had shown in my example. (I attached a snippet since you seem to be using LV2009 and my example was in 2010.)

 

 

I will note that your implementation is actually faster since there's a penalty with using the Read From Text File in "line mode". Still, though, I don't think the speed penalty outweighs the savings in diagram code, and amount of debugging that is saved with a much simpler implementation.

0 Kudos
Message 8 of 11
(2,819 Views)

smercurio_fc, ben64, you helped me a lot , many thanks !

 

I like the way ben64 programs, I must take a closer look on it. 

 

With you both help I'm now able to come closer to my solution, you have saved me much time ! again thank you.

 

I have no more questions at the moment !

 

 

Sincerely,

B.

 

0 Kudos
Message 9 of 11
(2,805 Views)

Bortoba wrote:

I like the way ben64 programs, I must take a closer look on it.


So you're saying you like long, complex, convoluted programming instead of simple and straightforward. Then you'd love the code in the Rube Goldberg thread. Perhaps we'll see some submissions from code you'll write in the future. Smiley Wink

0 Kudos
Message 10 of 11
(2,790 Views)