LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Append a string to a string array.

I'd like to append one common string to a string array without using FOR loop.
For example, for the array a,b,c.
I want to change to a%, b%, c% without For loop.
Is there any simple method to make it?
Message 1 of 16
(9,349 Views)
Hi labmaster,

the easy method is using the FOR loop...
Best regards,
GerdW


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

labmaster,

Any particular reason for wanting to avoid the FOR loop?

0 Kudos
Message 3 of 16
(9,337 Views)
In my bad habit, frequently, I prefered to use some loops (for, while, case, sequence ...).
I think such a loop is not helpful the readability of code.
0 Kudos
Message 4 of 16
(9,310 Views)
Hi labmaster,

from a labview programmers view it's a bad habit to stick to text based programming paradigmsSmiley Wink

I think this code is readable really good:

Message Edited by GerdW on 10-09-2007 09:49 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 16
(9,296 Views)


@labmaster wrote:
...without For loop.

Gerd solution is the natural way to do things in LabVIEW. Repetitive tasks on an array, element by element, call for a FOR loop.

If you don't want to use LabVIEW, you can do this also with paper, pencil, and an eraser, of course.

Please don't give us silly restrictions like that, but just ask for the best way to do this. Let us decide what we can use or not use. 🙂

(Next time you'll ask us to write labVIEW code while standing on one leg with the right hand tied behind the back or drink a beer while hanging upside down. 😄 Sure, it can be done, but why??? 🐵 

Message Edited by altenbach on 10-09-2007 01:04 AM

Message 6 of 16
(9,298 Views)
Labmaster is right: GerdW code is not much readable to JAVA programmers Smiley Very Happy



@altenbach wrote:

(Next time you'll ask us to write labVIEW code while standing on one leg with the right hand tied behind the back or drink a beer while hanging upside down. 😄 Sure, it can be done, but why??? 🐵 



Altenbach: if I'm right-handed should I tie left hand behind my back?

Okay, it's only monday...
Message 7 of 16
(9,283 Views)
Ciaaao Graziano, are you there?
Very good news for you: it's tuesday, indeed!Smiley Very Happy
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 8 of 16
(9,263 Views)
Hi Labmaster,
I suppose, you hoped for a solution that looks similar to the addition of numbers to arrays like in this picture:



But this is not possible in LabView, here the natural way is using the for-loop, as stated by GerdW. But while thinking about it, I found a way to solve the problem witout using a for-loop. And as you can see, this is far less readable than GerdWs solution.



@ Altenbach: I think your answer doesn't help and sounds a bit arrogant. Aren't it the silly questions, that keeps us thinking (e.g. here)

greets, Dave

Message Edited by daveTW on 10-09-2007 11:16 AM

Greets, Dave
Download All
Message 9 of 16
(9,261 Views)
Ciao Paolo,
   che bello, è martedì!!!!!  Stanotte ho rifletuto, e forse ho una soluzione per il mio pannello, basata sul buon vecchio model-view-controler

   Have a nice day!

graziano
0 Kudos
Message 10 of 16
(9,250 Views)