Jump to content

Move the value out of the for loop


jim85

Recommended Posts

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.

Regards

Jim

Link to comment

What are you trying to do with the "element" that you get from your array??

You could just wire the array into the For loop, and then it would auto-index your array, displaying each element as it goes through the array.

By the way, your shift register is not doing anything, since the left hand terminal is not connected to anything.

Link to comment

QUOTE (dblk22vball @ Feb 18 2009, 09:55 PM)

What are you trying to do with the "element" that you get from your array??

You could just wire the array into the For loop, and then it would auto-index your array, displaying each element as it goes through the array.

By the way, your shift register is not doing anything, since the left hand terminal is not connected to anything.

Hi,

Thanks for your reply. I have designed a different VI now, 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 an 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 new VI with this post.

Regards

Jim

Link to comment

QUOTE (jim85 @ Feb 19 2009, 11:25 AM)

Hi,

Thanks for your reply. I have designed a different VI now, 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 an 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 new VI with this post.

Regards

Jim

Hey Jim,

sorry, I think it could be very easy to help you if you'd explain what you're trying to do.

Please discribe your problem more precisely.

regards,

nicolas

Link to comment

QUOTE (nicolasB @ Feb 19 2009, 04:02 PM)

Hey Jim,

sorry, I think it could be very easy to help you if you'd explain what you're trying to do.

Please discribe your problem more precisely.

regards,

nicolas

I agree. I am completely in the dark about what you are trying to do therefore I can't even begin to suggest a solution for you. With that said if you are trying to process your data in parallel you could use a queue or a notifier to pass the data from one task (the For loop) to another task (draw your graph). That essentially is the basic method for passing data out of a loop to be processed by another task.

Link to comment

QUOTE (Mark Yedinak @ Feb 19 2009, 10:45 PM)

I agree. I am completely in the dark about what you are trying to do therefore I can't even begin to suggest a solution for you. With that said if you are trying to process your data in parallel you could use a queue or a notifier to pass the data from one task (the For loop) to another task (draw your graph). That essentially is the basic method for passing data out of a loop to be processed by another task.

Basically, 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. 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.

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 1st value 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.

I have selected “Make current values default” for the main VI and attached the sub VI with this post. I’m using this sub VI from “McLennan Motion Control”. Do you know any other simple method to do this without using those sub VIs?

Can you please help me with this? Thank you very much for your help.

Regards

Jim

Link to comment

From looking at your VI, each time you press Get Measurements, you get a string of data x.xxx, x.xxx, x.xxx, which you then put into an array, set your next GHz step manually, and then press get measurements again, correct?

Why cant you use the Match Pattern vi, use the comma as the match, get the substring before the match (which will be your first value), and then convert that string using the Fract/Exp string to number, and then you have the numeric version which you can put into the "appended array" for use with the XY Graph.

Link to comment

QUOTE (dblk22vball @ Feb 20 2009, 03:49 PM)

From looking at your VI, each time you press Get Measurements, you get a string of data x.xxx, x.xxx, x.xxx, which you then put into an array, set your next GHz step manually, and then press get measurements again, correct?

Why cant you use the Match Pattern vi, use the comma as the match, get the substring before the match (which will be your first value), and then convert that string using the Fract/Exp string to number, and then you have the numeric version which you can put into the "appended array" for use with the XY Graph.

Ya, you are correct, but I want to do everything automatically and continually by the VI. So I need a loop to choose those string one by one and break into piece(Just want to use the 1st bit only, as the amplitude or y-axis points) and then want to convert into number, again convert to array element to draw the graph.

I'm having the problem with run everything automatically. So far I can save those strings in the shift register, but I want to build a loop to choose those strings one by one.

Do you have any idea about that?? Thanks for your reply.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.