LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY-Plot out of a .csv file

Solved!
Go to solution

Here's what my data looks like and formatting wise i'm happy with that. I just chose to write the data in the columns because it looked nicer to me when viewed in excel.
But i wasn't able to handle the data like this in LabVIEW, that's why i deleted the first row to only have numerical data and transpose it afterwards.

 

2020-05-24_19h27_28.png

Best Regards,
MT_at_home
0 Kudos
Message 11 of 18
(1,316 Views)

Here's a quick draft (simplified for one graph). Arguably simpler.

(note that the "%,;" in the format defines comma as decimal delimiter as Gerd already showed)

 

 

altenbach_1-1590344982738.png

 

Message 12 of 18
(1,306 Views)

@MT_at_home wrote:

@altenbach wrote:

It is a really (really!) bad idea to call a file "csv" (comma separated values) because comma is the decimal delimiter in your language setting so it cannot be used as column delimiter. (my USA excel cannot open your file correctly!).


I'm sorry for that inconvinience, that's why i have set the semicolon ";" as a delmiter cause my excil won't work correctly with the comma ",".


I typically use a tab as the delimiter.  It looks nicer in a text editor as well this way.


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 13 of 18
(1,288 Views)

Thank you so much for this example, i adapted it slightly to my needs and added a shift register now and i removed the initial zero out of the plot.

I was able to plot 3 graphs into one chart but sadly not the way i'd like it.
I'd like to keep the points of my scattered y-Values but put a fit through them.

The standard way of LabVIEW to plot the added charts is sadly just a linear fit without my scattered points.

I was able to show the scattered points by manually selecting the according Plot/Common Plots/(Icon with points and linear fit) for each plot.
Can this be done automatically? (in my VI atm. i did it manually for Plot 2)

I'd like to generate a legend with the color and filename of each plot alongside too.That's why i gathered the list of opened files in a array.

Additionally, when loading a new set of values there's always a 0/0 plotted as last value of the last chart i can't get rid off.

My goal in the end is to display:
1. the scattered values per dataset
2. a matching fit through each set of scattered points
3. a legend with the filenames and colors.

Here's what i'm stuck with atm:

2020-05-25_00h16_26.png

2020-05-25_00h16_38.png

Best Regards,
MT_at_home
0 Kudos
Message 14 of 18
(1,283 Views)

Actually i was able to figure it out by now on myself for a linear fit. Just had to use the Active Plot and other matching property nodes.

Best Regards,
MT_at_home
0 Kudos
Message 15 of 18
(1,262 Views)

@MT_at_home wrote:

Here's what i'm stuck with atm:


  • You don't need any dynamic data and express VIs.
  • You need to initialize your shift register.
  • You can do a fit right there for each dataset
  • You get a first point of zeroes because you did not wire from "mark after read" of the header read to "start offset" of the data read. This meas you read the header again as data, which is of course zeroes. (Sorry, I actually had that in my code. Must have attached the wrong file). (still, to remove the first data point, you can do that on the complex array, not twice right before).
  • What kind of fit do you want? The data does not look linear. Do you want to fit all data at once or each plot separately? What x-range do you want for the fits? (same as data? A wider range? More points?)
  • A graph does not "fit" just interpolate. There is a very rich fitting palette for any needs.
  • Please attach your latest code so I can do efficient edits.
Message 16 of 18
(1,241 Views)
Solution
Accepted by topic author MT_at_home

Here is one possibility to get you started. It does an offset-free exponential fit, but any other model would be possible using the nonlinear fit tools. (Modify as needed. I am sure there are bugs)

 

altenbach_0-1590429733574.png

 

 

(It seems a bit clumsy having to select a file followed by loading it and there is also no mechanism to prevent loading the same file twice. You could load all csv files into a listbox and select from there (similar to my program here). You could even allow multiple selections and load all selected from scratch with each change.)

 

 

Message 17 of 18
(1,235 Views)

Hello altenbach,
thank you for your examples and explainations, they helped me a lot and made me able to progress with my work.

Best Regards,
MT_at_home
0 Kudos
Message 18 of 18
(1,209 Views)