LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D array output in a loop

Solved!
Go to solution

Hello,

I need output data (several array string) from FOR-loop to 2D array. I use Replace array subset inside the loop (after array initialize). Output works (I see each step right string in its right place), But each next loop clear all previous strings to 0 0 0 . Finally stay only the last string in result array (see fig). Output to file works perfectly.

LW_1.png LW_2.png

 

Similarly, no result outside of loop. 

LW_4.png LW_3.png

WHY?

I'm beginner...

0 Kudos
Message 1 of 10
(4,043 Views)
Solution
Accepted by topic author Zazra

You use the same starting array each time, not the last updated. Initialize the array outside the loop and set the crossover to the loop as shift register. Then, as now, use the replace array and feed the output to the right side shift register.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 10
(4,029 Views)

Thank you.

 

LW_5.png

Now out_array 4 is right. 

But outside Out_array 2 and Out_array are empty (grey zero fields). 

When I change tunnel mode for  Out_array to Indexing - "different dimentions" error appear. 

How to use out_array 4 - data outside the loop?

Message 3 of 10
(4,014 Views)

Hi zazra,

 

But outside Out_array 2 and Out_array are empty (grey zero fields). 

THINK DATAFLOW!

Those two array indicators stay empty UNTIL the FOR loop finishes!

 

How to use out_array 4 - data outside the loop?

Either finish the FOR loop - or use a local variable (as easiest, but not the only solution)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 10
(4,003 Views)

That sounds impossible. Can you post the VI?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 10
(3,994 Views)

Those two array indicators stay empty UNTIL the FOR loop finishes!

Its are grey with finished loop.

0 Kudos
Message 6 of 10
(3,993 Views)

deleted

0 Kudos
Message 7 of 10
(3,987 Views)

Here permutations.vi

0 Kudos
Message 8 of 10
(3,975 Views)
Solution
Accepted by topic author Zazra

It's because you're programmatically aborting execution of your VI instead of stopping the For loop properly.  Make your For loop conditional (right click on it and select Conditional Terminal) and wire that to where your current Stop is.

0 Kudos
Message 9 of 10
(3,962 Views)

Awesome, it is. Thank you!

0 Kudos
Message 10 of 10
(3,947 Views)