02-04-2016 05:35 AM
Hi there,
I am new to Labview, and have been stuck on a problem for a while, would anybody kindly help me out please?
Here is the question, I need to repeat a string in a for loop. let's say the iteration number N is 20, I would like the output from the for loop is
1, 2, 3 , ..., 9 , 10, 1, 2, 3 , ..., 9 , 10.
Thanks very much for your help!
Regards,
Raul
Solved! Go to Solution.
02-04-2016 05:42 AM - edited 02-04-2016 05:45 AM
Hi Raul,
according to the given example I would program this pseudocode:
FOR i := 0 to 19 string[i] := num2string( modulo( i; 10) + 1) NEXT
Remember: creating an array from a loop is easily done by utilizing AutoIndexing…
Using LabVIEW you can also create this code:
FOR i:= 0 to 19 a[i] := i NEXT a[] := modulo( a[]; 10) +1 stringarray[] := num2string( a[] ) string := Array2SpreadsheetString( a[] )
02-04-2016 05:52 AM
Thanks,GerdW!
I was thinking if there is a easy way to do that, like using the I in the for loop, it automatically gives number from 1 to 20, I just need to repeat the first half out it.
Regards,
Raul
02-04-2016 05:54 AM - edited 02-04-2016 05:55 AM
Hi Raul,
it automatically gives number from 1 to 20, I just need to repeat the first half out it.
Why not the other way around: create just half amount of those numbers and use BuildArray (or ConcatString) to use those values twice?
"Programming" most often has to do with being able to abstract a problem to develop an algorithm… 😄
02-04-2016 07:55 AM
Thanks! The problem has been solved by concatenating the output from the for loop.
Cheers,
Raul