LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read from .wfm (.txt) file data for dbl waveform

Solved!
Go to solution

Hello,

I am having trouble with reading from a *.wfm file. I attached the file below. I want to reconstruate out of this file a signal waveform.  The first lines are only there to characterize the measurement. After "Zeit[us];Ampl[V]:" are the data. the first column is the time in us and the second the amplitude in volts. Of course the file contains much more XY-pairs, but I shortend it.
In LabVIEW the waveform expects a 1D-Array of DBL but like you can see I have strings here. I know that there is a "Read from spreadsheet file.vi" but I can't get my waveform out of this file.

Can anyone help me please?

Best regards,

Max30

0 Kudos
Message 1 of 7
(1,954 Views)

Read the text file by lines (right-click on the Read Text File and there is an option to read the lines) until you read "Zeit[us];Ampl[V]".  After that, read the entire rest of the file (Read Text File with a count of -1).  Then use Spreadsheet String To Array with a semicolon (;) as the delimiter.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(1,951 Views)

Thanks for the suggestion. But still it isn't working. I get the error code 4 after I want to jump over the two lines after u [%].

0 Kudos
Message 3 of 7
(1,934 Views)
Solution
Accepted by Max30

It is obvious you are just mixing different methods and they will not work together.  At one point in the middle, you are reading the entire file and trying to use OpenG methods to look for certain values, which gives you the Error Code 4 on the next read.

 

Here is my method.  Use a While Loop to read a single line until you find that header line before the data.  You can add more logic inside of that loop to get your other parameters.  But after that loop, read the entire file and process as necessary.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 4 of 7
(1,923 Views)

It works pretty fine. But I don't know where the additional line comes from. The additional line starts in [0;0] and rises really slow till 0,25. Do you know whre this comes from?

0 Kudos
Message 5 of 7
(1,916 Views)
Solution
Accepted by Max30

@Max30 wrote:

It works pretty fine. But I don't know where the additional line comes from. The additional line starts in [0;0] and rises really slow till 0,25. Do you know whre this comes from?


You are now dealing with an XY graph, so it can go backwards.  What I am seeing here is you just have a final point of [0,0].  Most likely, this is caused by an empty line at the end of your file.  Try adding a Trim Whitespace with the trim setting set to End before the Spreadsheet String To Array.  If that does not work, attach your actual wfm file so we can have a look.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(1,908 Views)

Perfect. I hadn't worked with XY-Graph till now. Thanks for your help!

I put this Trim Whitespace of OpenG between the READ and the SPREADSHEET.

0 Kudos
Message 7 of 7
(1,889 Views)