‎07-09-2018 04:20 AM
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
‎07-09-2018 04:29 AM - edited ‎07-09-2018 04:36 AM
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 ?
‎07-09-2018 04:46 AM
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.
‎07-09-2018 04:56 AM
I updated the reply. But I don't think the unit data appears in the spreadsheet ... standby
‎07-09-2018 05:17 AM
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.
‎07-09-2018 05:48 AM
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.
‎07-09-2018 06:39 AM
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 !
‎07-09-2018 07:16 AM
"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
‎07-09-2018 08:28 AM
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.