LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reshape array

Solved!
Go to solution

Hi,

I have an 1d array of 0,1,2,3,4,5,6,7,8 using reshape array I can make it:

0 1 2

3 4 5

6 7 8

But I want the even rows to be arranged in the reverse order i.e

0 1 2

5 4 3

6 7 8

Can anybody tell how can I do that.

kind regards,

Zoton

0 Kudos
Message 1 of 6
(240 Views)
Highlighted

Hi Zoton,

 

But I want the even rows to be arranged in the reverse order

Use a loop on the reshaped array and apply Reverse1DArray on each 2nd row…

 

(Be careful what you define as "even row" as LabVIEW starts to count array indices with zero!)

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 2 of 6
(230 Views)

Hi Gerdw,

Thank you very much for your reply. I am new to this and I made the attached vi. Even though I am not sure if my approach is efficient or not but if I run the vi I cant build a new array with reversed odd index elements. After reading some related posts it seems like I need to use use the shift register as the previous rows gets replaced by zero. So my queries are:

1. How can I build the new array

2. How can i Initiate array for different data set size

Thanks again.

Kind regards,

Zoton

 

0 Kudos
Message 3 of 6
(137 Views)
Solution
Accepted by Zoton

This is all you need.

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 6
(115 Views)

I used replace array and shift register. Seems like its working. Is there any better way to do it?

0 Kudos
Message 5 of 6
(106 Views)

Dear Paus,

This is awesome. More neat than the one of mine. Kudos.

0 Kudos
Message 6 of 6
(104 Views)