08-20-2018 07:12 AM
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
Solved! Go to Solution.
08-20-2018 07:17 AM
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.
08-20-2018 08:00 AM
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 [%].
08-20-2018 08:50 AM - edited 08-20-2018 08:51 AM
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.
08-20-2018 09:57 AM
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?
08-20-2018 10:19 AM
@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.
08-20-2018 11:58 PM
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.