LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array of string to string

Solved!
Go to solution

Hi,

 

Im trying to convert a "2-D array of strings" to a "string". I there a simple/efficient way to do that?

My 2-D array is the user input from a listbox/table. The output has to be a string data type, which can be read using the combo-box indicator or a string indicator...

In other words, the input from a table should be converted to a data type similar to an input from a string control box...i went through some of the forums and discussions, i could not quite understand how exactly the conversion is done...

 

 

 

Thank you,

 

0 Kudos
Message 1 of 8
(6,907 Views)

To get a string out of a 2-D array of strings, you need to use the Index Array function.

 

Beyond that, we can't offer anymore help unless you post some examples of what your array data looks like and what you are trying to get out of it, and what the combo boxes have to do with it.

Message 2 of 8
(6,903 Views)

See is attached what you need.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 8
(6,896 Views)
Solution
Accepted by Eureka

@Eureka wrote:

Im trying to convert a "2-D array of strings" to a "string".



I agree with Ravens that it is not clear at all what you want. To convert an array of strings to a single string, simply use concatenate strings.

 

 

 

If the string should have delimiters, use "array to spreadsheet string"

Message 4 of 8
(6,878 Views)

Thats pretty close to what im trying to do...

Im currently able to convert the array of strings to string. But, im having some problem when i try to loop it...

Here is what i need:

I have a table(2D array of strings) and i need to be able to select 1 or more value from the table and feed that as an input to one of my sub VI.

Im trying to read value 0 to N-1, N being the size of my string array. This will read the individual values in the array.

Im currently using a table which is not so convenient. I think it would be better to use a listbox. The problem with a listbox i found was, it does not read the values in the array, instead, it reads the position of the values...like, 0, 1 etc...

 

 

 

Thank you,

0 Kudos
Message 5 of 8
(6,869 Views)

Attach a VI instead of an oversized picture. How are you running this?

 

A lot of your code makes no sense at all. If you are autoindexing, you should not wire N. You are indexing out an inner element that you don't even use. To get the strings of a single column, use "index array" on the 2D array with the upper index disconnected, the concatenate the resulting column data. No loops needed.

 

I would also stay away from matrix data types, they don't seem a natural choice here.

 

There are also race conditions due to overuse of local variables. Most likely, the "string total" will get read in the upper part before the lower part had a chance to update it. None of your locals are needed.

Message 6 of 8
(6,861 Views)

Hi,

Thank s for the help, i got over the problem of converting the array to a string...it works really well...

I have another problem...i have to plot waveforms with the data i get as o/p...it goes like this...I should plot separate waveforms for each and every channel i read the values from...let us say, i have 4 channels...im gonna have 4 different readings and hence i should plot 4 waveforms...I tried doing this with Waveform Chart and im able to scroll different values but its all in the same waveform...

So, i would like to plot "n" number of waveforms where the "n" is the number of channels selected by the user...

I have attached the VI to make things a little clear...

 

 

 

Thank you,

0 Kudos
Message 7 of 8
(6,824 Views)

Eureka wrote:

I have another problem...i have to plot ...


I would recommend to start a new thread. This has nothing to do with the original string problem.

 


Eureka wrote:

Thank s for the help, i got over the problem of converting the array to a string...it works really well...


 

Then please mark the most helpful answer as the solution and also give kudos to any other helpful contribution.

0 Kudos
Message 8 of 8
(6,754 Views)