LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multi XY plot

Solved!
Go to solution

Hello!

 

I have a for loop inside the while loop. For loop generates N pairs of data. Next step I want continuously generate N plots in one XY graph, but I can't find a way to do it.

 

Thank you in advance.

0 Kudos
Message 1 of 10
(3,930 Views)

When you post a question on the Forum, you want to be careful that it doesn't look like "Please do my homework for me".  One good way to do this is to post your code (attach the VI, or if there are several VIs, put them in a folder, compress the folder, and attach the resulting Zip file).

 

In your case, having the VI would clarify the following vague descriptions of your question --

  • For loop generates N pairs of data.   What does this mean?  Are you generating N clusters that have two elements (and what type are the elements)?  Are you generating N 1-D arrays (of something) where the arrays are of size 2?  Are you generating a 2D N-by-2 array of something?
  • Generate N plots in one XY graph.  Does this mean you want to make a single graph and have N points on it?  Often when someone says "N plots", I think of N "lines on a graph".
  • I want continuously ...  What does this mean?  Do you want to keep adding points to the graph?  Are you plotting the same graph over and over every millisecond/second/minute?  Are you aware of the difference (in LabVIEW) between a Graph (where all the points are plotted at once) and a Chart (where you can add data to the end of the plot)?

So go ahead, write some code (even if it doesn't seem to work -- presumably you can handle the While and For loop parts) and give it a try.  Incidentally, if you do put a Chart or a Graph in your VI, you can right-click it and open the Help screen which will probably answer many of your questions and allow you to at least wire it up and give it a try.  If it produces an unexpected result and you can't figure out how to fix it, come back to us, but include your code.

 

Bob Schor

0 Kudos
Message 2 of 10
(3,894 Views)

OK, I'll try to clear up the question.

 

The object is to measure temperature dependencies of current of my sample in different biases. For this I use generator to set bias and two multimeters to measure temperature and current. My VI sets N voltages one by one and reads temperature and current in a cicle. As result I have N two-dimensional arrays (temperature and current) that coresponds to N different voltages. I've made a VI that write data into files etc. But I want make a graph with N lines to control process.

 

For better understanding. I want such VI as attached one, but it shoud build not the last value graph, but 5 lines from a generated in the for loop values.

 

Sorry for bad english and thank you for response

0 Kudos
Message 3 of 10
(3,878 Views)

I would use complex arrays, makes things easier. See attached very simple example.

 

(Do you typically know the final number of curves at the start of the program?)

0 Kudos
Message 4 of 10
(3,842 Views)

 

The problem is that your example builds N lines with 4 points, and I need the opposite - 4 lines with N points.

 

The number of curves is external paraneter, set on front panel. 

0 Kudos
Message 5 of 10
(3,829 Views)

You can turn any diagram constant into a control, just "right-click...change to control". Now you can set it to any value you want (within reason, of course!).

 

The rest  of the code remains the same. You simply need to reaarrange things a bit to built the arrays differently. try it.

0 Kudos
Message 6 of 10
(3,819 Views)
Solution
Accepted by topic author 13archer31
0 Kudos
Message 7 of 10
(3,807 Views)

 

0 Kudos
Message 8 of 10
(3,797 Views)

Make sure you include a mechanism to clear the data in the shift register. If this VI runs for a long time, you might run out of memory.

 

Also growing array is expensive due to the constant need for memory allocations. If the total lenght of the traces is known from the beginning it would be much more efficient to allocate the final data structure (with all NaN) and replace with real data as you go. (values that are NaN are not graphed).

0 Kudos
Message 9 of 10
(3,787 Views)

We will need not more than 10 arrays with not more than 2000 data in each (don't know exactly how many at the beginning). So I don't think there will be a problem with memory.

 

But thank you. If there will be a problem I'll try to optimize VI.

0 Kudos
Message 10 of 10
(3,757 Views)