LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read from .csv file in this case

Hi forum,

 

I was finally able to save my waveform into .csv format, but now i have little problem with opening it and show it on my existing waveform graph. I know it should be inverse of saving but something evidently goes wrong. Can I count on your help, please?

 

Saving into file: 

Matipa_0-1596909973985.png

Trying to read with this:

Matipa_1-1596910005547.png

 

 

0 Kudos
Message 1 of 26
(2,351 Views)

The wire is broken.  What does it say when you hover over it?  From the picture, it looks like you're trying to wire two inputs into each other.

0 Kudos
Message 2 of 26
(2,322 Views)

Hi matipa,

 

right now you are parsing the first element in the CSV string again and again. You need to track the scan position or use the remaining string output of the ScanFromString function...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 26
(2,308 Views)

Hi matipa,

 

As GerdW stated, the read vi is only reading the first element of the string in the for loop. An alternative way would be to use the spreadsheet to array vi or Read Delimited Spreadsheet express vi to convert the string into array, then auto-index the array into the for loop to extract the information.

 

The broken wire is caused by wiring multiple waveform input into one waveform graph. To multiplot on a waveform graph, please refer to this KB: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LyxSAE&l=en-US

0 Kudos
Message 4 of 26
(2,233 Views)

Hmmm, Do You mean something like this?

 

Matipa_0-1597051771633.png

 

0 Kudos
Message 5 of 26
(2,216 Views)

Hi Matipa,

 


@Matipa wrote:

Hmmm, Do You mean something like this?


No.

You only need to convert from spreadsheet string to array once before the loop.

And you should convert to an array of strings as you want to parse timestamps and numeric values…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 26
(2,209 Views)

@Matipa wrote:

Hmmm, Do You mean something like this?


1. You don't actually need the Open/Create/Replace file function here.  Just wire your path the the Read Text File.

2. Right-click on the Read Text File.  There is an option in there to "Read Lines".  Now wire a -1 to the "count" input.  This will read your entire file as a array of strings (each line being an element of the array).  Now autoindex on this array and you can use the Scan From String inside of your FOR loop like you already had.


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
Message 7 of 26
(2,204 Views)

I made this, it works, but when I wire the exit of builed waveform to the existing wavegraph i see this error:

Matipa_0-1597225595396.png

When i add new wavegraph it looks good:

Matipa_1-1597225652911.png

Is there any posibility to do it on the same graph?

0 Kudos
Message 8 of 26
(2,163 Views)

Hi Matipa,

 


@Matipa wrote:

I made this, it works, but when I wire the exit of builed waveform to the existing wavegraph i see this error


THINK DATAFLOW!

You cannot connect two data sources (BuildWaveform and DAQmxRead) by a wire!

 


@Matipa wrote:

Is there any posibility to do it on the same graph?


Yes, sure.

Read the context help of the graph (terminal) to learn how to display more than one plot in a graph…

Spoiler
It takes an array of plots - like an array of waveforms…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 26
(2,159 Views)

Done, it is possible to connect this two waveforms in one, but then i having next problem (in two places):

 

Matipa_0-1597237247927.png

 

0 Kudos
Message 10 of 26
(2,145 Views)