LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

implement FOR loop in Labview with blocks

Solved!
Go to solution

Hi 

I am tring to convert the following For loop code to blocks. May you help me to do that  ?

 

 

aa = 1;
bb = n;
for i = 1:k-1
bb = bb*(n-i);
aa = aa*(i+1);
end
0 Kudos
Message 1 of 3
(736 Views)
Solution
Accepted by topic author HUSAM2324

Hi Husam,

 


@HUSAM2324 wrote:

I am tring to convert the following For loop code to blocks. May you help me to do that  ?

 

aa = 1;
bb = n;
for i = 1:k-1
bb = bb*(n-i);
aa = aa*(i+1);
end

  1. Create controls for n, k.
  2. Create a FOR loop.
  3. Create shift registers for aa and bb.
  4. Use the loop iterator terminal to calc your "i".
  5. Implement the math (mult. add, sub) inside the FOR loop using wires to the controls and shift registers.
Best regards,
GerdW


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

Thank you very much GerdW

0 Kudos
Message 3 of 3
(625 Views)