01-06-2010 06:52 AM
Hello 2 all !
I have the following problem : i have a string (which i read from a txt file), and using spreadsheet string to array function, i want to transform this string into a 1d array of double. MY PROBLEM is that the result string has only the first element. How can i see the other elements too ?
Thank you 4 your time !
P.S. I'm using LabView 8.5.1. on Windows XP SP 2
Solved! Go to Solution.
01-06-2010 07:01 AM
01-06-2010 07:05 AM
Thank you Paul G. That was a pertinent observation.
However, the 1d array still contains only 1 element.
01-06-2010 07:09 AM
If you typed in \n into a constant you will have an extra backslash. Change the view of the constant to '\'codes display and you will see two backslashes. Just delete one of them.
01-06-2010 07:11 AM - edited 01-06-2010 07:12 AM
Check the code below:
or solution only: (not sure why Path2 showed up... ignore it..)
01-06-2010 07:11 AM
01-06-2010 07:23 AM
YOU CHANGED HIS CODE! But simpler is always better. Kudos.
01-06-2010 07:28 AM
01-06-2010 07:30 AM
Hi Ray,
your solution is maybe "nicer" (it uses only one wrapper function from vi.lib) - but it is not the same!
The original version will pad using NaNs (instead of zeros from ReadFromSpreadsheet). This could be important and might change final results...
It's also more easy to change for personal needs (like using different prompts). So the only thing needed was to add the correct delimiter...
01-06-2010 07:51 AM - edited 01-06-2010 07:51 AM
Good call GerdW,
I looked at the text file and made the assumption that it would be all numeric followed by a new line, which is why I simplified the solution.
GerdW wrote:The original version will pad using NaNs (instead of zeros from ReadFromSpreadsheet). This could be important and might change final results...
Are you sure? Because I added "hello" as part of the data (right after '6'), and in both versions it placed 0 in the array. See image below: