LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting Tab/Space Delimited Data on X & Y Graph

Solved!
Go to solution

Hi Emil,

 

The displayed data does not have decimals anymore. It is also rounding my data. I would love for it to be precise with all the decimals.

Which decimal separator is used on your computer? I hope you use the point (like 1.23) instead of a comma (like German default 1,23)…

Try a format string of "%.;%f" for the conversion from string to numeric array.

 

In my data document that I attached, there is columns that say P1, P2, etc. 

So I would like to read all the 14000 rows thats in column P1, against time, which is also 14000 rows.

Some notes:

- There is no explicite time column in your data. You will need to calculate your own time data from the information in the header of your file. As you seem to use a fixed sample rate I recommend to use waveforms on a waveform graph instead of XY plots in a XY graph…

- When you want to plot different columns you need to implement a possibility to select them from your data. In my example snippet I just took the first two data columns: you are free to implement your own selection algorithm!

 

If there is a way to add Pages on the X Y Graph, to separate all the 16 columns worth of data, into the graph, but yet keep just one graph, thats what I am going to try and achieve.

No, there are no "pages" in a graph.

But you can have several plots and you can select the visibility of each plot.

You could also filter your data to only send the selected plots to the graph - THINK DATAFLOW.

 

Please NEVER hide any control/indicator labels in the block diagram!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 21
(1,212 Views)

Hi GerdW,

 

I changed the format string and voila, its now reading decimals too!

 

The sample rate is a 1000 hz.

Why Waveform Graph over XY Graph?

 

Yep, that's what my graph is showing me. Not sure how to achieve this. I guess I will have to look around on how some other people have solved this.

I do have a VI that kind of does that, I just wouldnt know how to combine that with my previous VI.

 

Alright.. I guess I will have to do that then! Whatever works is what I need! 🙂 

 

I like to keep it clean, but I do see where you are coming from! 😉

 

I'll link the VI that kind of enables you to select columns and such. I just dont really know how to handle all of that.

 

Thanks, Emil 

 

 

 

 

0 Kudos
Message 12 of 21
(1,205 Views)

Hi Emil,

 

The sample rate is a 1000 hz. Why Waveform Graph over XY Graph?

Because it would make your life a lot easier: all you need to set is the dt (=1/sample rate) in the waveform and the waveform graph would handle the X axis correctly for you…

There is an example VI explaining the usage of the different charts and graphs!

 

I'll link the VI that kind of enables you to select columns and such. I just dont really know how to handle all of that.

This VI loads a file (or multiple files?), analyzes the data and searches for some "End of File" marker. Then the data comes out of the while loop and is fed into the different graphs. All this doesn't look very nice, but seems to work.

All you need to do is to replace the file loading loop by your own code as this example VI expects a different file format than your data file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 21
(1,188 Views)

Neat! So, is there a way to add an adjustable sample rate function from the Waveform Graph, to where I can set it manually in the program?

Say I have a sample rate of 1500 hz instead, I would then want to be able to just input that and have it read off of this.

 

I did get it to read better, using the Waveform Graph, however, the document has empty rows every 1000 row and I would need to remove this for it to look great. Not sure how, frankly. (I am a total noob and need to do more tutorials)

 

So I tried doing this, just replacing the loading loop and inserted my own code. Not very smooth, since I probably didnt do it right.

Also, its using X Y Graph, which by now isnt what I want, seeing as the Waveform Graph was working so good. Not sure how to change this either.

I dont really know where to go about using this VI, I feel like I should just keep working on my original one, get it to where I can select column and then plot it on the same graph, but doing what you said earlier, to show different plots.

 

I am intrigued by LabView and will definitely want to spend more time working with it. I have been given this task, if I can succeed with it, I am getting this job with my dad. And working there, I will be getting paid to learn it... Just gotta get over this obstacle first! Hence why your help is much appreciated!

 

Thanks, Emil

0 Kudos
Message 14 of 21
(1,130 Views)

Hi, GerdW!

 

So changing to the Waveform Graph works great. 

I do need to remove empty lines in my document though, so I need to make a function to remove those.

 

I tried replacing the file loading loop with my own code and the problem is probably that I do not know how to insert it properly.

Also, since the Waveform Graph worked so great previously, I would like to change the X Y Graphs on this on into that. Again, I am not sure how.

 

I feel like I should just keep working with my original VI that we previously discussed and try and make something happen there. Right now I can get it to read P1 and thats it. Need to be able to select between the different data columns.

 

Thanks,

Emil

0 Kudos
Message 15 of 21
(1,176 Views)

Hi Emil,

 

I feel like I should just keep working with my original VI that we previously discussed and try and make something happen there.

That's a great idea!

 

Right now I can get it to read P1 and thats it. Need to be able to select between the different data columns.

In the other VI you see, how they make the selction for different columns. You can surely adapt this to your own VI… 😄

(Basically it's just the IndexArray.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 16 of 21
(1,163 Views)

Hi, back again!

 

I have been trying to fix my own VI. Basically got the layout how I want, now to that block diagram...

 

I want to Plot all of my data on the same graph, and then just be able to select the plots that I want to see. 

I also want to be able to select the sample rate.

 

I need to have all of the data graphed at once and then just select what I want to see. Not just my first plot like the case is now.


Oh and I need to remove every empty row, because apparently I have an empty row every 1000:th row...

 

Here is the VI and the Text file again... 

 

Thanks in advance for any advice, Emil

Download All
0 Kudos
Message 17 of 21
(1,165 Views)

Hi Emil,

 

as a starter:

check.png

You should read the sample rate from your data file…

 

Deleting empty rows is easy: you need to find all double EOL (end of line) chars and replace them by just one EOL. In your data file the EOL is CR+LF (hex 0D and 0A). As you already know how to replace double space chars by single ones I guess this is no problem for you! 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 18 of 21
(1,158 Views)

Very nice!

 

I am basically where I need to be with this project, all except for the EOL. Literally, if I can remove those empty rows every 1000:th row, I will be golden!

It's looking great and I just need those empty rows to go away! 😮

 

Here is my VI of how it is looking so far. If you want to insert the data to see for yourself, I also added the data file again.

 

I will try. Can't seem to find any EOL to mess with.. 

 

Thanks ALOT! You are great.

 

Regards, Emil

Download All
0 Kudos
Message 19 of 21
(1,151 Views)
Solution
Accepted by topic author Milleh

Hi Emil,

 

Can't seem to find any EOL to mess with.. 

Search for "\r\n" (string constant in \-code)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 20 of 21
(1,141 Views)