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: 

String to replace array subset

Hi!

I still have problems with fitting strings to spreadsheet file. I have modified Read- and Write to spreadsheet file VI so it's possible to save strings to spreadsheet file, but now problem is that "replace array subset" function doesn't directly allow add 1d string value to 2d table. With "Insert Into array" function I did solve this problem modifying string to listbox value, but that doesn't work with "replace array subset" function. I can't use "Spreadsheet string To Array" function in this case, because it converts strings to numbers and I need to save values in string format to file. Any ideas how I can convert string to 2d array?
0 Kudos
Message 1 of 9
(3,366 Views)
You need to turn your concatenated string into a 1D array of strings before you can replace a row in the 2D array with it.

(Simply feed it through a "spreadheed string to array" with an "array type" input of a "1D array of strings" and a format of %s.)
0 Kudos
Message 2 of 9
(3,355 Views)
Hi!

I did try use "spreadheed string to array" with those format and input values, but still data types doesn't match (error message below). Have I done something wrong in "Read from spreadsheet file" modification or what can cause this problem?

These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Help window to see what data type is required.
The type of the source is 1-D array of double.
The type of the sink is 1-D array of string.
0 Kudos
Message 3 of 9
(3,350 Views)
You did not read my reply correctly!

The only thing that you need to do in the first picture, is replace the broken wire with "spreadsheed string to Array", exactly as described. There will be no more error (See attached image).
0 Kudos
Message 4 of 9
(3,328 Views)
Hi!

I did try use that "spreadheed string to array" as your picture show and it did give those error messages which I describe earlier. That's why I wonder is something wrong in my "Read from spreadsheet file", because "replace array subset" function still complain about connecting two different types of wire. There is part of my VI attach this message (it's done with Labview version 6.0). I hope that can help you notice what I'm doing wrong.
0 Kudos
Message 5 of 9
(3,309 Views)
You need to change the array that you are giving to spreadsheet string to array from an array of DBL to an array of strings. See image. if you need help on doing this then let us know.

Message Edited by jhoskins on 04-20-2005 09:54 AM




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 6 of 9
(3,292 Views)
I said an ... "array type" of 1D array of strings ...!

You are still trying to convert it into a 1D array of DBL numbers! You don't want any kind of orange color on your diagram. 🙂

The only thing you need to do is grab the DBL in the array container and replace it with an empty string. (Or you could just feed the string through a "build array" as shown in the alternative solution below it). There will be no error!

(Note that the solution shown by jhoskins above will ALSO break your VI, because it uses a 2D array of strings).
(edit: typo)

Message Edited by altenbach on 04-20-2005 08:09 AM

0 Kudos
Message 7 of 9
(3,283 Views)
oops? my bad Did not notice i had a 2d.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 8 of 9
(3,268 Views)
It worked. Thanks! I'm quite newbie with LabView so I didn't realize difference in color in my VI and sample VI.
0 Kudos
Message 9 of 9
(3,242 Views)