LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to include a string

I have a file which saves dynamic data types in 5 columns.

I want to add time stamp in one column.

I want hour:Minute:second.
I concatenated the strings and made a string time stamp-

but i have problem with Data Type conversion!

How can i include this array of timestamp into my data file?
0 Kudos
Message 1 of 16
(3,157 Views)

There are many ways to write data and timestamp information to files in LabVIEW. For a thorough reference, check the LabVIEW example finder. Just click on help, find examples in LabVIEW and select fundamentals, file input and output. The "write text file" and "write datalog file" examples should be exactly what you are looking for.

I hope this helps. If you need more assistance, please let me know which VI you are using to write the text file and provide details of data collection, timestamp strings, etc.

Casey Weltzin, National Instruments

0 Kudos
Message 2 of 16
(3,142 Views)
Thanks for the replySmiley Happy

Iam using write to spreadsheet file VI to save data.

when even a value is saved i also want the time at which the values is saved .

firstly i used get time/date stamp vi, then 3  fornat date /time string VIs  where i took huor ,minute and second output from them and concatanated .
this time stamp in a conacted array should be included in my datafile.

how can i do that?

Yes i have been looking into tutorilas,exampes and also context help!

0 Kudos
Message 3 of 16
(3,139 Views)
The write to spreadsheet VI typically converts a 1D or 2D array of numbers to strings and stores them in a text file. Since the timestamp information is already in string form, the "write to text file" VI is probably a better choice.
 
When aquiring data inside your loop, you have a single timestamp and one or more data values for each iteration. Use the "format into string" VI and drag down the bottom of the VI to create more inputs. Wire in timestamp, tab constant, data1, tab constant, data2, etc. Then wire the string output to an output terminal in your loop to build up an array of strings.
 
Now you have a 1D array of strings that are each tab delimited. This 1D array of strings can be wired to the "write to text file" VI to save the timestamp and data information. Note that you must use the "create file" and "close file" VIs along with the "write to text file" VI.
 
I hope this helps.
 
Casey Weltzin
National Instruments
0 Kudos
Message 4 of 16
(3,134 Views)
Hi.....i have just followed and included all those steps in my VI ,but i dont see any data in my file.

i post my vi here can u please where did i go wrong?
Thanks!
0 Kudos
Message 5 of 16
(3,117 Views)
Hi twilight,
the vi Write Characters to File tries to open the file, but it is already open (by Open/Create/Replace).
You should use the function Write File like you already do writing data lines.
You don't need to use three different formats to the date/time value: use only one with format %H:%M:%S. Moreover, you forgot to add a tab after the time string.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 6 of 16
(3,110 Views)
'Hi Thanks!

I removed three fomats ,and made one.
yes,as u said there r two files created when i run the program one its saving headers and the other data.
how can change this?

Iam sorry i cudnt do itRobot Sad

0 Kudos
Message 7 of 16
(3,107 Views)
Oops, I didn't notice you were trying to write 2 different files. What do you need to do? One file or two files? With what name?
When running your vi I get an error because the filename for the header file is not valid. The Search and Replace function will only replace one occurence of the "/" character, so you need to call it twice. Moreover, the dates compared in the same portion of the block diagram are always the same, so the comparison result will always be True. You should store the date string in a shift register in order to detect a date change.

Paolo
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 16
(3,104 Views)
Thanks for your time.

iam quite new to LabVIEW may be 2months(not regularly) iam into it.

I need only one file.

 i want two dates so that when acquiring data , if the date changes( like i start Data Aquistion today,and it runs throughout night perhaps till tomorrow evening),so it is always good for analysis if the data is saved in 2 files.

can headers and time stamp in H:M:S format  be added to Write LVM file.
0 Kudos
Message 9 of 16
(3,100 Views)

Hi twilight,

Absolutely, you can add timestamps in that format in the header. You can also timestamp the filename, however, do not use the columns ":".  For instance you could use a naming convention that looks like mainfilename_yymmdd_no

mainfilename:  a descriptive name

yymmdd:  060613

no:  sequential number

You could create two filenames in parallel, one being even number and the other odd.

Also, depending on implementation, it could automatically create a new filename as soon as the actual time passes midnight.  Nothing fancy or special to add to the code.  As they say, "there are many ways to skin a cat"....  I've never skinned any cat... nor would I want to, but it's just a saying..

JLV

=== Footnote:  No cats were harmed in this post ===

Message 10 of 16
(3,091 Views)