LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to call same vi for 4 times in a single vi?

Solved!
Go to solution

Hi.. I ve one vi named 1D array Mult. I need to call this vi four times in another vi program. The problem i ve experienced is all the four vi outputs are same.

 My question is: How to call the same vi for many number of times?

 

Thanks in advance

0 Kudos
Message 1 of 12
(3,147 Views)
Post your VI.
0 Kudos
Message 2 of 12
(3,144 Views)

Hi,

    I attached two vi here. In 2D array Multiplication,1D array Multilication.vi is to be called for 4 times.

 

     if we call the same base vi for times means the vi executed for the same output irrespective of inputs.

 

    I had this problem while implementing at the first time. So i duplicated the base file of 1D array-mult.vi as 1D array-mult1.vi, 1D array-mult2.vi, 1D array-mult3.vi in the same folder. In my 2D arra-Mult,vi, i called individual subvis. Then only i got the correct answer.

 

My ques: Is it possible to call the same base for 4 times in a single vi?

Thanks for responding.

Download All
0 Kudos
Message 3 of 12
(3,139 Views)
Solution
Accepted by topic author deepak.aamecece
0 Kudos
Message 4 of 12
(3,132 Views)

There is no problem (programmatically) with calling the same VI by placing it 4 times onto the block diagram.  You do not have to rename them VI1, VI2, VIn if they all do the same thing, as you have done here with 1D-arrayMult...  It's just messy.

 

You may need to make re-entrant in certain cases.

 

A better way to do it would of course be to use a For loop as shown (I left what you did in tact).

 

terrible VI.png 

 

Are the two formula nodes identical?  I didn't check.  If so, use a for loop there too.  Build your A and B matrices to a 3D array and auto-index in For loop - single instance of your formula node.

 

It is quite concerning what you have done in your 1-D Array VI.  I have no idea what it is supposed to be doing, but it appears to be nothing; it is completely wrong.

 

There are backwards wires, your While loop does nothing (there is not shift-register) - how will it Stop?!, your cases 0, 1 and 2 are all the same!  Timer of 1000ms??! hmm..

 

disaster VI.png 

 

If you are trying to multiply two matrices (arrays) together then just use the native LV function to do it and to add them at the end try this:

 

matrix_mult_add.png

 

Hope this helps you!

Message Edited by battler. on 03-12-2010 03:49 AM
0 Kudos
Message 5 of 12
(3,129 Views)

Hi battler,

 

thanks for inculing the pics.

 

@deepak:

The part with those two subtract nodes is also very elegant! I would use a constant with value "1", but you use 2 subtracts to solve the formula N-(N-1) Smiley Wink

If these VIs are made in LV8.6 or better then please use the diagram cleanup from time to time!

Best regards,
GerdW


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

@battler:

 

 

      The problem i had experienced is while executing the same function 4 times, all the four outputs from 1D array Multiplication is same. then i duplicated the base vi into 4 different names. after this only i got the correct answer.

 

       what i did is: In 1D Array multiplication i multiplied two 1D array and got a result of an integer.

 

      So while implementing the 2D array multiplication, i splitted the 2d array multiplication into rows as well as column terms and i am performing the 1d array multiplication 4 times for 2x2 matrix. Do u got my point?

 

      For your next question:

 

            the while loop executes for  2n times  if  a nxn matrix is provided as input and it stops automatically.

 

In case structure, i used index array function.  i am giving different  index values for the accessing the array element one by one,thereby multiplying that and producing the result.

 

 

 thank you for guiding me.

 

Can u please send some programs to implement thereby i can improve my program skills in labview? I am new to this area.thank you.

 

 

 

 

0 Kudos
Message 7 of 12
(3,113 Views)

@ muks;

 

        hi i am using labview evaluation version.

 

 

I couldnt download the Recursive calls in labview using  VI server... How to download it ?pleaseguide me...

 

thank you for your response

0 Kudos
Message 8 of 12
(3,112 Views)

Hi deepak,

 

where is the problem with following muks' link and download the provided ZIP archive?

 

The only point I found is maybe your LV version (which you haven't stated so far): The example is very old and provided in LV5, which can't be opened by LV2009... But then you are able to use recursion in LV2009 without any additional tools or tricks, just read the manual!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 12
(3,104 Views)
0 Kudos
Message 10 of 12
(3,100 Views)