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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Catch error in array to spreadsheet string fro text values

I was using "Array to spreadsheet string" to convert a tab-delimited string of numbers, when I noticed that if you input a line which contains text, eg:
1 2 fred 4
it just converts the text to zero - there's no error cluster output, nor does it convert the text to "NaN"

I'd like to catch this error, and pass a user-defined error cluster out of the vi. Also, I'd like to check that the string has the expected number of columns and/or rows.

I'm can write my own vi to do this, but it occurred to me that someone else on the forum has probably done it already, and probably done it more efficiently than I can!

TIA

Joolz
0 Kudos
Message 1 of 3
(2,329 Views)
After posting a related answer HERE, I have modified that VI to partially do what you need: Set all fields that are not numeric to NaN. (Notice that this is a simplifiend version, e.g. if a field contains "1fred" you'll get the number "1", and not NaN).

If you need very strict checking, feed the 2D array of strings into two nested FOR loops and check each stringlet for the presence of non-numerics.
0 Kudos
Message 2 of 3
(2,329 Views)
Neat, thanks a lot!

I did try looking for posts like your original one, honest!

Cheers

Joolz
0 Kudos
Message 3 of 3
(2,329 Views)