LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write a for loop as to read repeating 2 array values into 2D size from 10 1D array size

Solved!
Go to solution

Hello everyone , i need a help about to write for loop or may be some other logic as you know for 

I have a 1D array [1 2 3 4 5 67 8 9 10]...now i want use for loop that reads 2 values as ([ 1 2]) and set these 2 values in first row  of 2D array and again loop repeats read another next 2 values as ([3 4 ])  and set them 2 row of 2D array  like that 3 row [5 6] in 2D array .....like that it write 5 rows in 2D array (2*5) from 1D array of (1*10)...you can say some other easy way as not exatcly  to be for loop ...thanks alot for your help and suggestions ...waiting for your answers 

0 Kudos
Message 1 of 4
(2,503 Views)

Have you bothered to make some sort of attempt to program this?

0 Kudos
Message 2 of 4
(2,500 Views)
Solution
Accepted by topic author janybasha

 

The short answer is that you need to use the Reshape Array function.

 

The longer answer involves more questions.  Do you always have the same size 1D array?  If not, will it always have an even number of elements?  If not, what do you want to do with the last element?  If you keep it, what do you want to use to "pad" the extra element of the output array?

 

Example_VI.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 4
(2,490 Views)

thanks alot 

the above idea working perfectly ...but i got one problems in same application ...i read so much data continuelsy from serial port(VISA ) but it read only till 504 data bits and then goes down 425 again it goes to 504 again down to 425 like that continuously up and down data bits ...i want to read data continuesly unlimitted 

 

how to to do that setting to read continuously unlimitted data bits ?   I am using VISA function to  read from serial port 

is there any other way to read data bits from serial port continuously unlimitted data bits after i leave running system continuously

 

thanks alot for your help ...waiting for a good sloution 

0 Kudos
Message 4 of 4
(2,436 Views)