05-24-2020 10:08 AM - edited 05-24-2020 10:13 AM
Hello together,
I have a .csv file containing my x-axis and several y-axis-values.
The problem is, that i can successfully convert the x-axis to a number again but the y-axis just end up as zeros.
As you can see in the pictures containing my arrays i first transpose the data so i can cut out the rows for my x and respective y-axis and convert them to a number afterwards.
Sadly in the conversion my y-data gets lost.
Here are some pictures of my example data, the VI is attached too.
I'd be glad if someone could help me to figure out my mistakes.
Solved! Go to Solution.
05-24-2020 11:09 AM - edited 05-24-2020 11:14 AM
Hi MT,
you forgot to attach an example CSV file: how should we debug your VI without the data?
You core routine could be made much simpler:
Why do you need to convert to numeric values on your own when ReadDelimitedFile can do this for you?
Why do you use DeleteFromArray when you need an ArraySubset?
Why do you need to transpose the array when you can easily index columns instead of rows later on?
Why do you need two indicators/controls to maintain a list of filenames when you can use a shift register/feedback node?
Why do you need an additional WaitForMultiple next to your event structure with a timeout event?
(As you seem to use German regional settings I changed the default format string for ReadDelimitedFile. I recommend to use English regional settings when handling measurement data!)
05-24-2020 12:14 PM
As Gerd already mentioned, you have some other serious issues. Here are a few more:
05-24-2020 12:32 PM - edited 05-24-2020 12:34 PM
@GerdW wrote:
Hi MT,
you forgot to attach an example CSV file: how should we debug your VI without the data?
You core routine could be made much simpler:
Why do you need to convert to numeric values on your own when ReadDelimitedFile can do this for you?
Why do you use DeleteFromArray when you need an ArraySubset?
Why do you need to transpose the array when you can easily index columns instead of rows later on?
Why do you need two indicators/controls to maintain a list of filenames when you can use a shift register/feedback node?
Why do you need an additional WaitForMultiple next to your event structure with a timeout event?
(As you seem to use German regional settings I changed the default format string for ReadDelimitedFile. I recommend to use English regional settings when handling measurement data!)
Okey, to provide some additional information:
The exmaple data was written in another VI as a composition of index names for the columns in the first row and the data below that.
That's why the first row is deleted so i only have numerical values left.The data is fine, its just 0.1 for several values which change later on.
I used the transpose function because i didn't know any better and saw a way for indexing by row and not by column.
I didn't figure out how to get the shift register right in the event structure so i chose the way way with two indicators/controls.
Why i have the while loop?
Just for handling the stop button and my list of opened files i guess.
So most things i do is just because i don't know any better, i'm relatively new to LabVIEW and just trying to get things working.
Here's a picture of my example data, which i attached the file of now.
Thx for your advices so far, but what did i do wrong when converting my data of the y-Axis so it ends up as zeroes? I want to understand my mistake there.
05-24-2020 12:43 PM
@altenbach wrote:
As Gerd already mentioned, you have some other serious issues. Here are a few more:
- You don't need the timeout event because all it does is poll the stop button, and reset the "data laden" latch action button.
- You need to accumulate the list in a shift register with the indicator before the event structure.
- You need an event for the stop button.
- The events should be "value change", not "mouse up" and the terminal belongs inside the event case. ("mouse up" can be very dangerous because it even triggers for disabled controls, possibly overriding essential safety interlocks in an industrial application. )
- It is extremely annoying if the diagram and front panel is maximized to the screen. At your stage of learning you need to be able to look at both as well as the help window at the same time.
- In your original message it sounded like you have multiple Y value columns. Is that still true? Your VI does not show that.
- From the image it looks like all x-values are the same (0.1). Is this real or a display issue?
I am working in maximized windows because i work on a triple monitor setup.
I said i have multiple y-values and that's still true, i just wanted to plot one of these in that graph.
My goal is to plot several graphs, each containing the same x-axis but different y-axis values.
In the end i want to visualize the data of several files in common plots.
In a way like this for files with i just call by index 1, 2, 3 for now:
x1 & y1.1,
x2 & y2.1,
x3 & y3.1 go into one graph
x1 & y1.2,
x2 & y2.2,
x3 & y3.2 go into the next
x1 & y1.3,
x2 & y2.3,
x3 & y3.3 go into antoher graph again and so on...
The values with 0.1 are fine, just reappearing a few times before changing.
05-24-2020 12:46 PM
05-24-2020 12:48 PM - edited 05-24-2020 12:51 PM
@GerdW wrote:
Hi MT,
you forgot to attach an example CSV file: how should we debug your VI without the data?
You core routine could be made much simpler:
Why do you need to convert to numeric values on your own when ReadDelimitedFile can do this for you?
Why do you use DeleteFromArray when you need an ArraySubset?
Why do you need to transpose the array when you can easily index columns instead of rows later on?
Why do you need two indicators/controls to maintain a list of filenames when you can use a shift register/feedback node?
Why do you need an additional WaitForMultiple next to your event structure with a timeout event?
(As you seem to use German regional settings I changed the default format string for ReadDelimitedFile. I recommend to use English regional settings when handling measurement data!)
Thx for the example with shiftregister, i just didnt know i can it do it like that, i tried to wrap it around my case structure.
I will try to adapt my solution to your example, but can you still tell me what i did wrong in my try converting the data to a number so i got the 0-Values for my y-Axis?
All the Indicators on the way to the plot are just for visualizing/debugging atm.
05-24-2020 12:49 PM
Sorry, here it is.
05-24-2020 01:08 PM
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!).
05-24-2020 01:13 PM - edited 05-24-2020 01:19 PM
@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 ",".