LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

STRING

Hello community,
I have a problem with filling an Array with String values. 

What I'm trying to do, is to fill a bidimensional array with string values, but I don't find a way to make it possible.
I would like to know if there's a VI that allows you to fill the array with string values, by only indexing it with row and columns.
Something like the "Set Matrix Element" VI, but with strings (As showed on annexed file).

Thank you for your help!Smiley Happy
 

0 Kudos
Message 1 of 11
(3,055 Views)

Hi Mattia,

 

to process arrays you should use array functions like ReplaceArraySubset

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,045 Views)

A "matrix" has a very special narrow meaning in LabVIEW. It is only defined for numeric elements (real or complex) and mostly useful for operations in the linear algebra palette.

 

What you want is a 2D array. Here the element can be of any datatype, from numerics, to strings, to complicated clusters.

 

If you want to fill the array sequentially or randomly, you should initialize a 2D array of strings of the desired size, place it in a shift register, and then use "replace array subset" to substitute the default element value (e.g. empty string) with the desired strings.

 

See how far you get. Post your code if you get stuck.

0 Kudos
Message 3 of 11
(3,018 Views)

Thank you, I partially solved the problem, but one other arised...

Following both yours suggests, I'm now able to fill the 2D Array, but the value, after being put into the 2D array, disappears just after the new one that comes, is written.

The code has been annexed.

I didn't use shift registers because I had problems with the wires configurations. 
Solving the shift registers issue will probably solve the whole problem. 
If you could poste a code solution, I would really appreciate it.

Thank you again!


0 Kudos
Message 4 of 11
(3,008 Views)

Please attach your VI instead of a picture so we don't have to start from scrach.

0 Kudos
Message 5 of 11
(3,001 Views)

Here it is. The string is written into the matrix just for a brief moment, then it disappears. 

 

0 Kudos
Message 6 of 11
(2,992 Views)

@Mattia_Perazzelli wrote:

Here it is. The string is written into the matrix just for a brief moment, then it disappears. 

 


Try this.... modify as needed.

0 Kudos
Message 7 of 11
(2,980 Views)

You'll need to initialize your array outside your for loops. Then use shift register to store the array each time though the for loop, that should populate your array with how you want.

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 8 of 11
(2,978 Views)

Oh, ok. Now it works as it should have, great!

Thank you for your help again, I hope this is gonna be helpful for others!

0 Kudos
Message 9 of 11
(2,971 Views)

@GerdW wrote:

Hi Mattia,

 

to process arrays you should use array functions like ReplaceArraySubset


I always thought that was one of the most awkwardly labeled nodes - but I can't come up with anything better.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 11
(2,941 Views)