LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write one string in different arrays

Hi!

I like to write a value in a string in an array of 12 elements. If I
connect the array to the string LV say I should insert the created array.
So I insert a "build array". But I will fill 12 elements in this array
with this string (preconditioned there is a concomitant connection between
my choosen ports). I thougt I must tow this build array to 12. But what
should I connect before? It is the same string, so I connected this, but
now it wrote the string everytome in the array elements.

What must I do?
~~~~
Regards
Sarah

LV 7.1.1
0 Kudos
Message 1 of 8
(3,538 Views)
Hello sarah83,

maybe you should try the "Initialize Array" function. Put your string as "element" and wire 12 to the dimension size. This way you get an array of strings, containing 12 element with your string as content.

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(3,538 Views)
Hi Gerd!

I used initialize array, do you mean I should augment this for 12? Because if I do this LV wants insert 12(!) index arrays. And after this it don't work.
What do you mean with string as element?

The fiddly is, depending on a option choice I have to write the string in 2, 4 or 12 elements of an array (everytime the same array).

Thanks
Sarah
~~~~
Regards
Sarah

LV 7.1.1
0 Kudos
Message 3 of 8
(3,538 Views)
Hello Sarah,

I have attached an VI to show you a possible solution.
It inits an empty array of strings and replace some (or all) elements with your string, depending on the selected option.

Hope this helps,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(3,538 Views)
Hey Gerd,

your example was helpful, thanks.
But it don't do what I want until now :-s

Maybe the problem is, where I compare my strings, if the string which was sent over the port is the same as the string before. Maybe I must change this into arrays. But is it possible to compare each elements in two arrays? I mean element 1 with element 1; element 2 with element 2 and so on?
~~~~
Regards
Sarah

LV 7.1.1
0 Kudos
Message 5 of 8
(3,538 Views)
Hello Sarah,

you can compare arrays with single elements or with other arrays. In both cases you get an array of boolean. See the attached example, I used numbers instead of strings because of easier coding.

Best regards,
GerdW
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(3,538 Views)
Hi Gerd,
I would like to attach on which I'm working at the moment for understanding the background but it isn't possible :-s

Cu
Sarah
~~~~
Regards
Sarah

LV 7.1.1
0 Kudos
Message 7 of 8
(3,538 Views)
Hello Sarah,

try this:
gerd.wieczorek@epost.de

Best regards,
GerdW
Best regards,
GerdW


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