LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Time data not increasing in data file

Solved!
Go to solution

Hi, 

I have an issue in my current labview program. I want to log the elapsed time, however when I log it, it is not continuously increasing. It decreases some of the times, even though the display in the front panel shows the correct time. Any ideas? Can i log the time another way? Additionally, the time starts, as i run the program, but as I am saving the data first, the time does not start at 0. Can I change that, so that it either logs while i'm saving or starts at 0 after saving?

 

I am not near the thermocouples right now, so that's why it has a random generator. 

 

I also have another issue with the headers of the data, as i cannot seem to "transpose" them into columns instead of rows - however this is secondary, as it can be fixed in excel afterwards. But it would be nice, if it worked from Labview.

 

cha_au_0-1738232007345.png

cha_au_1-1738232062489.png

 

 

0 Kudos
Message 1 of 7
(151 Views)

Okay, i will just answer myself and ask a new question.

I see what the mistake is now, but i don't know how to fix it. 

It seems as if I am building arrays, and each time I am adding a new value, it sends all the value to the file. I just want it to send the latest value, so that I don't have huge amount of data stored in the arrays. 

 

Are there another way to store the values or send it to the measurement file? 🙂

 

Thanks. 

0 Kudos
Message 2 of 7
(132 Views)

Hi cha,

 


@cha_au wrote:

it is not continuously increasing. It decreases some of the times, even though the display in the front panel shows the correct time. Any ideas?


The elapsed time works as expected…

 

It's the way you save those data! In each iteration you write ALL collected data again and again to your file - instead of saving just the data of the current iteration…

 


@cha_au wrote:

I also have another issue with the headers of the data, as i cannot seem to "transpose" them into columns instead of rows - however this is secondary, as it can be fixed in excel afterwards. But it would be nice, if it worked from Labview.


You cannot transpose a 1d array: a vector is a vector!

I see two options:

  • create a 2D array of string data for your header, then you can easily define the "direction"…
  • probe the string before writing to the file: it should contain the expected "row-wise" text. Otherwise your string formatting is incorrect: Let's do some code debugging!

On your images: why did you downscale those images? Now both are hard to decipher…

Best regards,
GerdW


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

@GerdW wrote:

You cannot transpose a 1d array: a vector is a vector!


Some people come from Matlab where a "column vector" != "row vector". 😄

 

To the OP, you are still way overcomplicating your code despite my guidance from days ago. All you need is a shift register with a single 2D array where you append a row if you really need to graph all data forever, eventually running out of memory. (To only see the last N points, use a chart!).

 

Appending an ever-growing 2D array to a file is just plain silly, The file size will more than double with each iteration and contain mostly redundant data! All you need to append is one row.

 

 

0 Kudos
Message 4 of 7
(112 Views)

Hi altenbach,

I tried incorporating the things you said, but I agree, that it is really complicated, but i am still not sure how to fix it. I put the save file inside the loop, which also works, but as you say, I keep saving huge amounts of data, that I don't want.

I see your point with the graph, so I will definitely use a chart instead. I saw some people using the chart for saving only the last data as well? 

How do i append only one row? (chart?)

 

How do I only use one shift register? Just from the appended array? 

 

Sorry for all the questions, I really appreciate your answers. 

0 Kudos
Message 5 of 7
(98 Views)
Solution
Accepted by topic author cha_au

To chart the data and save the current row, you don't need a shift register, but here's how appending a row to a 2D array would work.

 

Below you can see how to chart the data and append the time and data as a new row to the file.

Since you know the loop time, you should set the dt of the chart accordingly once before the loop.

 

altenbach_0-1738314478866.png

 

 

You need to start over with the basic tutorials!

 

0 Kudos
Message 6 of 7
(85 Views)

Thanks, it works now and is so much more clean. 

0 Kudos
Message 7 of 7
(43 Views)