09-26-2015 12:43 PM - edited 09-26-2015 12:45 PM
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.
Solved! Go to Solution.
09-26-2015 01:39 PM
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 --
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
09-26-2015 02:15 PM - edited 09-26-2015 02:17 PM
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
09-26-2015 03:15 PM
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?)
09-26-2015 03:40 PM
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.
09-26-2015 03:54 PM - edited 09-26-2015 03:55 PM
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.
09-26-2015 04:02 PM
try this...
09-26-2015 04:16 PM
09-26-2015 04:44 PM
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).
09-27-2015 02:44 AM
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.