LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Move the value out of the for loop

Solved!
Go to solution
Hi guys,I have designed a VI with the for loop, shift register and the local variable. I want to increase the index value by 1, when the for loop execute each time. But, I couldn’t change any value until the for loop execution is finished. Can anyone help me with this problem please? I have attached my VI with this post. RegardsJim
0 Kudos
Message 1 of 15
(3,935 Views)

You have data flow problems based on not understanding how LabVIEW works.

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

 

First, your shift register isn't doing anything because you never use the value on the left hand side of the For loop.

Second, the top hand code only executes once, as soon as the VI is started and it returns whichever element happens to be selected by your Index control.

 

What are you trying to do with this VI?  Are you trying to step through each element of the array?  Or just return a particular element of the array?  What are you going to do with the element ( or elements) that you return?

 

0 Kudos
Message 2 of 15
(3,929 Views)

Hi ,

 

 

If ur trying to extract elements in an array one after the other,check out this vi.

 

 

 

Rgds,

Venky

0 Kudos
Message 3 of 15
(3,902 Views)

Venky,

 

That's a lot better than the VI from the original poster but you need to learn a bit more about LabVIEw basics and how for loops work as well. Of course, with the modified example, every element in the array (except for the last) is going to flash by so quickly that there;s no point to it, but you can see how the autoindex feature of a for loop works.

 

 

Message Edited by Dennis Knutson on 02-18-2009 07:41 PM
0 Kudos
Message 4 of 15
(3,893 Views)

Hi guys,

I have tried as you said, but I can get the array elements inside the for loop only. I couldn’t get the array elements value outside the for loop, one by one when the for loop execute. Because I have received this array from the S-parameters network analyser, I want to use those values to plot a x-y graph. So I have to break the array elements separately to draw this graph. Do you have any idea to move the value outside the for loop or any other method to break this array?

I have attached the vi as you said, with this post.

Regards

Mayuren

0 Kudos
Message 5 of 15
(3,868 Views)
It's still very unclear what you want to do. An XY graph requires 2 arrays - you only have one. If you want to display the data you have on a graph, just wire the array to a graph indicator. I don't understand why you think you have to 'break the array elements separately'.
0 Kudos
Message 6 of 15
(3,841 Views)

I’m trying to do draw a graph with frequency (X-axis) and amplitude (Y-axis).  I have to manually enter the frequency which is the X-axis. But for the amplitude, I have to use the result which is come from the S-parameter analyser. The result is coming in an array format and I need break it out to get the values. For an example the frequency range is between 1GHZ to 10GHZ, and I want measure the amplitude for every 1GHZ gap (10 values). I have to manually increase the frequency by 1GHZ in the analyser and read the amplitude value from the analyser.

The problem is, the analyser gives the values for all those 10 measurement amplitude together by one array value. So I want break the array by using index array, after that I have break the each values into different pieces (Because in each of the 10 measurement result value from the analyser have 3 output values, but I’m only going to use one of the values only) and then convert into numbers and then again convert back to one dimension array as an y-axis input value for the graph.

Now I’m having the problem with the breaking array from the analyser by using index analyser. That’s why I used for loop to break the array one by one and use the value separately after that.

Thank you very much for your help. I know, this application is very complicate to explain and understand.  Can you please help me with this? Thanks a lot anyway.

 

Mayuren

0 Kudos
Message 7 of 15
(3,822 Views)

It sounds like you have a 1-D array of frequencies that are values of 1Ghz to 10 GHz with intervals of 1 GHz.  And you have a 2-D array of 10 rows and 3 columns.  Where each row corresponds to one of the X values, but you only want to use of of the 3 columns.  (Or it could be the rows and columns are swapped, but I wouldn't know without seeing the raw data).

 

You can use Index Array function to get a single column out of the 2-D array.  That will return a 1-D array with 10 rows.  Now you have 2 1-D arrays of 10 rows you can manipulate to feed to the XY graph.

 

For further help, please post a VI that has real data stored in it either as constants or as controls/indicators where you use "Save Current Values as Default" before you save the VI and post.

0 Kudos
Message 8 of 15
(3,817 Views)

It would also help enormously if you provided the make and model of the analyzer. I havve no idea why you are entering the x axis manually. This is something that you can set programatically and also something you can read. It's a simple matter to use the start frequency and delta f in a normal graph to plot your y values.  Are you using an instrument driver?

0 Kudos
Message 9 of 15
(3,810 Views)
Hi,I’m using Agilent 8720 ES, S-parameters network analyser. I used this device to display the electromagnetic field effect graph. The graph is display on the analyser display; I have display the same graph on my VI. So, I’m using only one marker (which is the X-axis value or frequency) and take the amplitude reading (which is Y-axis value) around 10 values as I said before. I have to move that marker along the real graph on the analyser and take several maker reading (10 values). The marker values are the amplitude values(Y-axis values)on the graph. I didn’t use instrumental driver software. I have attached the full version of my VI with this post, please have a look. Thanks again for your help.Mayuren
Download All
0 Kudos
Message 10 of 15
(3,786 Views)