LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String into measurement file (Excel)

Hello,

I would like to save a string into the first column of an excel sheet.

How can I convert the string in to dynamic data?(attachement)

 

Thanks!

Andy 

 

0 Kudos
Message 1 of 9
(3,555 Views)

Hi Andy

You need to convert the string to a numeric and then to dynamic.

The string needs to be in a suitable format for conversion.

Update - Looking at it again it looks like the string is a unit identifier nA ..?

In which case you may want to send this string to the Unit terminal of the Set Dynamic Data Attributes vi ?

String to dyn.png

 

0 Kudos
Message 2 of 9
(3,547 Views)

Thanks for the answer

 

I am measuring current with an electrometer which measures in 11 ranges. With a dropdown control I choose the corresponding range. In the excel sheet I`d like to save the elapsed time (works), the value of the current (works) and the unit of the current (doesn`t work). 

 

With your suggestion the sting to number output is always 0. 

0 Kudos
Message 3 of 9
(3,540 Views)

I updated the reply. But I don't think the unit data appears in the spreadsheet ... standby

0 Kudos
Message 4 of 9
(3,535 Views)

I think the only way to do this may be to use the Write Delimited Spreadsheet VI.

Set the delimiter to a comma and use a .csv file extension which should open in Excel by default. Convert both the time and current to strings and then merge them into an array.

 

CSV.png

0 Kudos
Message 5 of 9
(3,525 Views)

Thanks for your answers!

 

I tried your solution but couldn`t open the file as an Excel. 

I am now working with the Set Dynamic Attributes and set the unit as an header of the file.

 

 

0 Kudos
Message 6 of 9
(3,514 Views)

You need to make sure that the file is saved as "filename.csv" to open it in Excel.


Yes I looked at the atrributes idea but the Units parameters doesn't appear to be available within the excel file. Let me know if you find a way ! Smiley Happy

0 Kudos
Message 7 of 9
(3,510 Views)

"Excel" can mean one of two file formats -- the proprietary "native" Microsoft Excel format, a .xls or .xlsx file, or a pure Text file, the Comma-Separated Values (.csv) file, which has nothing to do with Excel except that if Microsoft Excel is installed, it creates an "Excel-like" Icon for .csv files.

 

LabVIEW has several ways of writing both Native (.xls) and "Text" (.csv) files.  I've not used Write to Measurement File, but it does seem to support Native Excel.  So does the Report Generation Toolkit, which is installed with the Full or Professional versions of LabVIEW (and needs to have Microsoft Excel installed in order to work).  Text "Spreadsheet Files" can be read and written with Read/Write Delimited Spreadsheet functions on the File I/O Palette.

 

There are compromises!  Text files are necessarily files of text, which means that everything is a String Representation, including Floats (so there may be precision issues) and TimeStamps.

 

Bob Schor

0 Kudos
Message 8 of 9
(3,505 Views)

Various versions of Excel actually support a whole host of file types not just xls/xlsx and csv, including xml, dif, txt etc. But nevertheless, I think one of Andy's requirements is to capture the units within the spreadsheet so the text "compromise" appears to be necessary. The length of the numeric string can be as long as needed to store the required precision so in reality it's not a problem as long as the set up isn't required to store vast amounts of data at high speed.

0 Kudos
Message 9 of 9
(3,496 Views)