LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Nested Loop Help

Hello,
 
I have generated a simple VI, to make multiplication and division operations. I have the following operation performed with the following inputs.
 
A1 has a value range from 1 -10 fixed
A2 has an input range of 1 - 5
A3,A4 are constants.
 
so Result  = (A1*A3 ) / (A4*A2)*100 ,
 
I want to  plot "Result Vs. A1" with a current value of A2, increment A2 and repeat the procedure. So I generate 5 graphs and display it in only one. I need to write a nested loop to perform this operation.however I am able to do it only once.
 
I am trying to use for loop structure in one another but havent gone ahead in this.Any help will be appreciable..Thanks in advance.
 
0 Kudos
Message 1 of 8
(3,183 Views)
You just need two nested FOR loops, they will generate your 2D array that you can feed to a waveform graph.
 
 

Message Edited by altenbach on 08-02-2007 01:17 PM

Download All
Message 2 of 8
(3,176 Views)

Thanks Altenbach.

That works perfectly for me. thanks again for a prompt help..

Ravi

Message Edited by Dravi99 on 08-02-2007 03:22 PM

0 Kudos
Message 3 of 8
(3,161 Views)

Hi again,

Based on the previous example, i am trying to modify this vi.

There are few things that I am not figurin it completely.I want to generate a similar graph which has multiple plots, but cant get it done.

The Problem is that I want to plot the division result vs. the # of array out elements and i am unsuccessful at it. May be i am missing on the waveform graph properties.

Currently the OUT and IN are constants, will be controls instead of contants. 

I would appreciate if I get some help to get this thing working.

 

0 Kudos
Message 4 of 8
(3,065 Views)


Dravi99 wrote:

The Problem is that I want to plot the division result vs. the # of array out elements and i am unsuccessful at it. May be i am missing on the waveform graph properties.


You should make the current values default before saving so we have some typical data to play with. 😉
 
Currently, your code makes very little sense, because the inner loop has no purpose.
If you plot the division result versus array index (I assume that's what you want, I don't understand what you mean by "the # of array out elements "), you only have one plot. What should be on the other plots???
 
Please explain or even attach an image of the desired output. Thanks! 🙂
0 Kudos
Message 5 of 8
(3,062 Views)


altenbach wrote:


Dravi99 wrote:

The Problem is that I want to plot the division result vs. the # of array out elements and i am unsuccessful at it. May be i am missing on the waveform graph properties.


You should make the current values default before saving so we have some typical data to play with. 😉
 
Currently, your code makes very little sense, because the inner loop has no purpose.
If you plot the division result versus array index (I assume that's what you want, I don't understand what you mean by "the # of array out elements "), you only have one plot. What should be on the other plots???
 
Please explain or even attach an image of the desired output. Thanks! 🙂


Thanks Altenbach for the inputs.
 
I have made the values default. Srry for the previous one.
 
Now the inner loop was placed so that i can create a 2D array.
 
I need to plot the division result vs. the value of the element in the arry out. i.e. currently my array out has 0.0...,0.3 I want that to be the X axis.
 
 The graph plotted   is for 1st value of "in", this value will change like from 4.5 to 4.7 to 4.9, not necesarily in steps.
Thus my one graph should have multiple plots of "in" which has the above mentioned axis.
 
Hope this time i was clear in my msg. I have attached the modified VI.
 
 
 

 
0 Kudos
Message 6 of 8
(3,054 Views)
Sorry, I still don't quite understand. Do you just want to autoindex the "array in" on the inner loop as in the attached modification?
 
(You don't need to wire N if you autoindex on an array, it only complicates the code :))


Message Edited by altenbach on 11-19-2007 03:50 PM
0 Kudos
Message 7 of 8
(3,049 Views)

Thanks altenback,

autoindexing could be done. I am sorry for not being clear. I did not completely understand the modified vi. Smiley Sad

The modified vi, has my partial answer. the x axis is correct the y axis is also correct but plotting is done for individual element of array out divided by all elements of array in.

that has to be for different values of constant "in".

what i mean is that if 'in' takes values of 4.5, 4.7 , 4.9 then for a value of 'out =1.8' we plot this.

Thus our graph will have three plots one for 4.5, other for 4.7 and 4.9. where the x axis is elements of array out ( which is correct now in modified vi ) the Y axis will have the result of division.

hope i am clear this time.

Thanks a ton.

 

 

0 Kudos
Message 8 of 8
(3,040 Views)