03-10-2020 02:41 AM
Hi guys
I have app, when i read from sensor. I want my sample save in .csv file.
Saving is in while loop with reading from sensor.
But always i get :
Data is always overwritten on same line.
Solved! Go to Solution.
03-10-2020 02:55 AM - edited 03-10-2020 02:59 AM
HI Yaamamoto,
when you want to append data at the end of the file you need to set the file position to the end of the file after opening it…
@Yaamamoto wrote:
If i want get time stamp to every sample i need my array with values unite with time stamp?Is possible in LabVIEW treat for some reason malfunction of communication? (I mean, if sensor stop workings, i need get data like xFF still write on my csv.file)
You can also format the timestamp to text and concat strings before writing to file.
You can handle any malfunction as you like - you only need to create your program as needed by your requirements…
03-10-2020 04:24 AM
If you're doing this inside a loop, you should usually open the file before the loop and close after, and keep a file reference inside a shift register for the Write operation.
This will automatically keep the cursor at the end.
If you have to open and close repeatedly, then you'll need to use Set File Position as GerdW said.
You can see this link for more details: Append to a Text or Binary File in LabVIEW
This is copied from the 2nd link and explains a bit more (copied here for ease of reference):
When a file is opened in LabVIEW the cursor is set to the first position in the file. When a Read Text File or Read Binary File function is used it scans the full file and subsequently moves the cursor through the file to the end and so when a write occurs after that it will do it from the end.
03-10-2020 05:15 AM
Thank you.
I tried get timestamps to samples, but Humidity is never written.
I connect timestamps :
03-10-2020 05:21 AM
05-15-2023 11:05 AM
I have a question and have a different issue. I attached the code I have. I used to program in LabView, (2003), totally forgot how to solve my issue. Thanks for having time to look at it.
I am trying to save a set of data collected. I need to plot the data vs time. Time should be in seconds, or milliseconds. The problem is that when I save it, it saves either in Year/Month/Date/... format, or something which is given in the picture below. What I want is to save the data in seconds, instead of changing the format in CSV file in excel.
Thanks for assisting.
Best, S
05-15-2023 01:31 PM
Hi inst,
@inst_soleil wrote:
I am trying to save a set of data collected. I need to plot the data vs time. Time should be in seconds, or milliseconds. The problem is that when I save it, it saves either in Year/Month/Date/... format, or something which is given in the picture below. What I want is to save the data in seconds,
It's all your fault! You are saving "complete" timestamps in the first column - and you are using Excel to look at them…
When you want "just" elapsed time since start of measurement then you should save that value instead.
Do you know how to measure the (elapsed) time since start?
05-16-2023 04:36 AM
Hey GerdW,
I appreciate your comment.
Agree with you, and I don´t know how to correct it. Do you have any guidance that can help me to correct the program?
Thanks for your time and effort.
05-16-2023 05:00 AM
Hi inst,
@inst_soleil wrote:
Do you have any guidance that can help me to correct the program?
Right now there is a "sample time" timestamp, formatted as an absolute time string.
You need to replace that by a relative time (aka "difference between sample time and time of start of measurement") and you need to change the formatting of that relative time value to suit your requirements…
05-17-2023 02:56 AM
I couldn't make it. The elapsed time
It is not counting or saving to the file. Am I connecting the wrong wire? Or do I need to use Shift register?