03-12-2010 02:35 AM
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
Solved! Go to Solution.
03-12-2010 02:41 AM
03-12-2010 03:14 AM
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.
03-12-2010 03:41 AM
03-12-2010 03:46 AM - edited 03-12-2010 03:49 AM
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).
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..
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:
Hope this helps you!
03-12-2010 04:00 AM
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)
If these VIs are made in LV8.6 or better then please use the diagram cleanup from time to time!
03-12-2010 04:22 AM
@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.
03-12-2010 04:24 AM
@ 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
03-12-2010 04:34 AM
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!
03-12-2010 04:59 AM