From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(2,641 Views)

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


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,631 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

 

Download All
0 Kudos
Message 3 of 6
(2,538 Views)
Solution
Accepted by topic author Zoton

This is all you need.

"If you weren't supposed to push it, it wouldn't be a button."
Message 4 of 6
(2,516 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
(2,507 Views)

Dear Paus,

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

0 Kudos
Message 6 of 6
(2,505 Views)