09-12-2011 07:26 AM
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
09-12-2011 07:36 AM
You need to get rid of the first row and coloum.
This vi I use the array subset vi to do that.
09-12-2011 08:07 AM
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.
09-12-2011 08:23 AM
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.
09-12-2011 10:09 AM
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.
09-12-2011 01:43 PM
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.
09-12-2011 02:47 PM
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
09-12-2011 05:39 PM - edited 09-12-2011 05:40 PM
@ben64 wrote:
Altought not optimized
Well, that's a bit of an understatement. 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.
09-13-2011 03:37 AM
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.
09-13-2011 08:49 AM - edited 09-13-2011 08:50 AM
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.