From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Generate 2D array pattern efficiently

Solved!
Go to solution

I created this for loop 

to create a pattern in a 2D array that looks like this (for N=5):

012345

112345

222345

333345

444445

555555

Is there a more efficient way of doing the same thing: Input any N and get the above shown matrix pattern?

 

I appreciate any guidance on this subject!

Thank you.

0 Kudos
Message 1 of 5
(2,365 Views)
Solution
Accepted by johndoe108
Message 2 of 5
(2,355 Views)

Genius! Haha. 

 

Thank you!

0 Kudos
Message 3 of 5
(2,341 Views)

Separating the two loops gives me another factor of 2 in speed.

0 Kudos
Message 4 of 5
(2,271 Views)

Hi Nambu,

 

for which value of "N"?

(Have you tried to use loop parallelism for large values of N? With disabled debugging options?)

Best regards,
GerdW


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