12-05-2024 10:52 PM
Hi all, I want to plot multiple plots in a single waveform.
Overview:
First, I select model (1 or 0), it is the input for case structure.
in the case structure depending on the input (model select) the waveform should plot the readings.
for 1 it is 5 plots.
for 0 case it is 3 plots.
I tried it is showing some error.
Don't worry about the controls I have placed I am reading data from different instrument so it will always change.
Solved! Go to Solution.
12-05-2024 11:32 PM - edited 12-05-2024 11:33 PM
Not sure why you use a local variable if you could just wire to the terminal. Cluster are fixed size and you can either make it large enough and don't use some of the input or use a 2D array instead.
The chart data type gets defined by what is wired to the terminal. Wiring to a local cannot do change that for good reason.
Your case should be an integer, of course.
(Posting by phone, cannot look at your VI)
12-06-2024 12:53 AM
I could wire it directly to the terminal. What about other case. it will show conflict error.
(I understand)
12-06-2024 01:19 AM - edited 12-06-2024 01:19 AM
As I said, I can't look at your vi, but the clusters must match in type. I still recommend to go with a 2D array instead.
12-06-2024 08:44 AM
The error is because the waveform chart is expecting a 3 element cluster for case 5 and you are trying to wire a 5 element cluster on case 1.
One work around solution is to plot a 5 element cluster on both cases, but add NaN on the 4th and 5th element . THis way the Waveforme Chart can be wired to both cases without the need of local variable, if you leave them (the inputs) outside of the case, you can eliminate the 3 local variables as well.
I created a waveform chart 2 that is wired to 5 element cluster
12-06-2024 10:11 AM - edited 12-06-2024 10:13 AM
OK, I had a look at your VI and here's what you could do.
The problem is that if you change the mode during the run you must clear the chart history because some assignments will change. Of course you need to change the plot legend and number of visible elements whenever the selector changes, which would be easy to implement. Another option would be to just always plot all five, but use NaN for the ones you don't use. This way the lines will remain correctly assigned even if you change mode during the run.