LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save data as an array and create a graph for processing

Solved!
Go to solution

hi. 
I am a Labview beginner...
I keep receiving one piece of data. I want to use that data to create the program I want.

I expressed the algorithm that I wanted to create in a 'pdf file'.
I made a little bit of labview vi with my little knowledge, but it's not enough to build my algorithm.

I'm looking for help because there's no one around me to ask it.
Please help me...
thank you!!

Download All
0 Kudos
Message 1 of 29
(1,195 Views)

Hi nickbruk,

 


@nickbruk wrote:

I am a Labview beginner...

I made a little bit of labview vi with my little knowledge, but it's not enough to build my algorithm.

I'm looking for help because there's no one around me to ask it.


Why are there so many frontpanel elements without a label? Would you create code in text based languages like this:

IF "" THEN do something
"" := "" + ""

So PLEASE: NEVER delete the label of frontpanel elements! You can hide it on the frontpanel when it bothers you…

 

When you want to collect samples in an array then you need:

  • an array wire
  • use a shift register in your loop to hold that array wire
  • use BuildArray to build an array (aka prepend or append elements to an array), InsertIntoArray is only meant to "insert in the middle of an existing array"!

What's the point of running the loop endlessly?

Why is there a small wait inside the Save case, but not in your main loop?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 29
(1,153 Views)

As has been said, a diagram where almost all terminals have an empty string as label is very dangerous, because we cannot tell what's what and mistakes are easily possible. If you don't want to see the label on the front panel, you can hide it (right-click...visible items...label), but it should always be visible on the diagram and more importantly have a reasonable name (e.g. "save" instead of "Boolean 1")

 

Your jumble of string operations could be replaced by a single "format into string" with several inputs and a suitable format.

 

Your currently write three fields to the file: date/time, temperature, mean(x), Apparently you want to write the date/time only once, so that probably belongs before the loop. Since the path name is outside the toplevel while loop, it can never be changed once the program runs. Do you want to load that same file again or some other file?

 

You leave out many scenarios:

 

  • What should happen if save is pressed before 6 values are averaged?
  • What should happen if more than 6 values are averaged?
  • Your temperature is a user input, not a random value.
  • What should happen if the file contains less than two points (no linear fit possible!).
  • Your random value is in the range 0..1, but your mean(x) axis is 0..10. Do you need some scaling?
  • Where does the "reference point" value come from?
  • What should happen if no button is pressed? (Certainly not spin the loop billions of times per second!)
  • etc....

 

0 Kudos
Message 3 of 29
(1,142 Views)

Thank you so much for your advice.

Labels were added to unlabeled panel elements.

Additionally, we used a shift register to store it in an array and averaged it.

Here, we entered a random number, but in reality, we are continuously processing data, so it runs endlessly in a while loop.

For string operations, I left it as is because I didn't know how to use the string format.

- If you press the save button before calculating the average of 6 values, the save button should not work. Therefore, when the size of the array exceeds 6, I want the boolean to turn on and the save button to become active.

- It doesn't matter if you average more than 6 values. However, when we press the save button, the array stored in the shift register is initialized and we should be able to receive 6 new values as an array again.

- The temperature can only be saved if the user inputs it. If we press the save button, I would like the temperature value to be reset to 0.

- Time/date and location input can only be done once, and if ‘x(mean data) and temperature(y) data’ are entered according to the conditions, they must be saved in the corresponding txt file.

- The file must contain at least 5 points to load the txt file and draw an xy graph.

- When we press the ‘Load button’, we should be able to select and load a txt file. (We will create many txt files with different data stored in them.)

- Scaling of the x and y axes is required.

- I am wondering how to specify the ‘reference point’ value. In my opinion, I would like to create a reference point check boolean and have it displayed next to the temperature and data mean in the txt file when clicked, so that it is applied when loading the txt file.

 

thank you, 

0 Kudos
Message 4 of 29
(1,093 Views)

I posted an answer, can you help me?

 

I need to make this program quickly...

 

Thanks you so much!

0 Kudos
Message 5 of 29
(1,045 Views)

Hi nickbruk,

 


@nickbruk wrote:
  1. - If you press the save button before calculating the average of 6 values, the save button should not work. Therefore, when the size of the array exceeds 6, I want the boolean to turn on and the save button to become active.
  2. - It doesn't matter if you average more than 6 values. However, when we press the save button, the array stored in the shift register is initialized and we should be able to receive 6 new values as an array again.
  3. - The temperature can only be saved if the user inputs it. If we press the save button, I would like the temperature value to be reset to 0.
  4. - Time/date and location input can only be done once, and if ‘x(mean data) and temperature(y) data’ are entered according to the conditions, they must be saved in the corresponding txt file.
  5. - The file must contain at least 5 points to load the txt file and draw an xy graph.
  6. - When we press the ‘Load button’, we should be able to select and load a txt file. (We will create many txt files with different data stored in them.)
  7. - Scaling of the x and y axes is required.
  8. - I am wondering how to specify the ‘reference point’ value. In my opinion, I would like to create a reference point check boolean and have it displayed next to the temperature and data mean in the txt file when clicked, so that it is applied when loading the txt file.

  1. When you want to dis-/enable the save button then you need to use a property node of that button!
  2. When you want to clear (aka re-init) the array data in the "save data" case then you need to wire the array data THROUGH the case structure. Manipulate the array data inside the cases as needed…
  3. Again: when you want to do certain stuff inside a case structure then you need to implement that stuff inside the case structure! What about writing a "0" into a local variable of "Temperature"?
  4. You already do this in your VI…
  5. I don't understand this sentence.
  6. Again you want to react on a button: what about another case structure?
    (At this point you might learn about using the event structure to handle all your button actions…)
  7. Scaling of the chart/graph axes is a right-click option (aka property of the axis)…
  8. I don't understand what you want. Please provide an example of your requirement!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 29
(1,027 Views)

hello.

Thank you so much for your reply!!

  1. Condition 1: I would like to add a condition where the save button is disabled and then when temperature, location and time are entered and the data array size is 6, the save button is activated and we can save.
  2. Condition 2: Also, when you press the save button, the temperature value must be reset to 0 and the 6 saved array values ​​must be initialized so that 6 data and temperature can be entered again. After that, condition 1 is repeated.
  3. For the reference point, I created a Boolean button and saved it as ‘value 1’ when clicked, and 0 otherwise. When loading a graph, I would like to use the temperature with the ‘value 1’ in column 4 of the txt file as a reference point.

 

I would appreciate it if you could help me implement the LabView program based on this information.

I am attaching the vi I modified.

Thank you so much again.

Download All
0 Kudos
Message 7 of 29
(992 Views)

Hi Nick,

 


@nickbruk wrote:
  1. Condition 1: I would like to add a condition where the save button is disabled and then when temperature, location and time are entered and the data array size is 6, the save button is activated and we can save.
  2. Condition 2: Also, when you press the save button, the temperature value must be reset to 0 and the 6 saved array values ​​must be initialized so that 6 data and temperature can be entered again. After that, condition 1 is repeated.
  3. For the reference point, I created a Boolean button and saved it as ‘value 1’ when clicked, and 0 otherwise. When loading a graph, I would like to use the temperature with the ‘value 1’ in column 4 of the txt file as a reference point.

  1. IF (Temp=valid AND Location=valid AND ArraySize>=6) THEN EnableButton ELSE DisableButton
  2. IF SaveButton THEN Temp=0, Array=[] ELSE don't change their data
  3. Load the data txt file, filter for all rows with a "1" in the 4th column.
    Is there a chance there might be more than one row with a "1" in column 4?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 29
(986 Views)

thank you!

I don't know how to implement the method you mentioned in my vi.

Can you show me an example in my vi?

0 Kudos
Message 9 of 29
(966 Views)

3. There is no possibility of having more than two 1s in column 4.

0 Kudos
Message 10 of 29
(959 Views)