From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-22-2015 08:59 AM
Hey everyone,
I'm trying to copy one csv file to a template. The problem is that im using a read from spreadsheet and copying the content using string. Which is fine. However, certain column just have numbers which is transfered as a text. It isnt too much of a problem but may interfere with some equations i have that will be converting those numbers in the same sheet. Is their a way to read the first column as a string and the other as a double? I believe i can index the array but im a little confused about it.
12-22-2015 09:33 AM
Continue to read in the data as a 2D array of strings but then pick out the column (or columns) that have the numeric data and convert the string data to numeric data.
12-22-2015 09:33 AM
12-22-2015 09:34 AM
12-22-2015 09:53 AM
You mean like this?
Frankly because I did not know that those conversion funtions would work on arrays as well as individual values.
But now that I do know, I'm not sure I'd use it anyway because the FOR-loop method gives you a level of error checking and reporting for the string-to-numeric translation that the single conversion function does not offer. You can feed the single function any manner of garbage and the only hint of a problem is that some or all of the resulting DBL array will be zero. The FOR-loop method will report a conversion error for the same garbage.
12-22-2015 10:20 AM
Thanks Dennis and WNM. I looked at some examples but it didnt help me that much. @WNM i Came up with something similar using the examples within LV. When you use the numeric control, what number do you use? Lets say i want to copy column 2 and 3. would i set it at 2 and then 3?
12-22-2015 10:31 AM
12-22-2015 10:35 AM
12-22-2015 10:50 AM
Thanks for clearing that up, didnt know it was 0 based. Thanks you guys for the help.
12-22-2015 03:14 PM
The attached example VI is one I put together long ago to help me sort out which array index was associated with which nested auto-indexing loop and which terminal input on the expandable array functions. SInce you are new to this, perhaps you might find it useful as well.