LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Realtime plot

Halloechen!

I need an xy plot of my data that is updated every time when a new
chunk of data has arrived (the chunks should be appended to each
other simply). So far, I did the following:

I created an 1D array large enough to hold the whole data set. Then
I have a loop in which each data chunk is measured and inserted into
the big array with the proper offset (offset = chunk length *
iteration step number). Then I send the array to a signal display.

This works by and large, however the display seem to have seconds on
the x axis which means that each chunk is 80 "seconds" wide although
there are only ten readings per chunk. The rest is zero in the
display which looks confusing.

Because I didn't find someting to do about it, I now use an xy plot
inste
ad. But it wants to have an unfortunate data type as input,
namely an array of xy pairs. So I need to expand my 1D array by the
x value which is simply the current array index.

Any ideas how to solve this?

Thank you!

Tschoe,
Torsten.
0 Kudos
Message 1 of 7
(3,457 Views)
Torsten,

Keep using the waveform graph! The x-y graph is only needed if the x-values are not spaced evenly.

If you don't want to show missing data as zeroes, initialize your 1D array with NaN instead of zeroes. These won't show on the plot. In addition, you can also disable autoscaling, then programmatically update the x-axis range to the range of valid points using a property node. However, sometimes it is more intuitive to keep it at the final range and see the data slowly fill the display as the experiment progresses. NaN values will prevent plotting zeroes to the right of the insertions.
0 Kudos
Message 2 of 7
(3,457 Views)
Halloechen!

altenbach writes:

> Keep using the waveform graph! The x-y graph is only needed if the
> x-values are not spaced evenly.
>
> If you don't want to show missing data as zeroes, initialize your
> 1D array with NaN instead of zeroes. These won't show on the plot.

Yes, however, they still seem to take horizontal space. But instead
the x value should be just the index of the data point. How can I
get rid of that time axis?

Tschoe,
Torsten.
0 Kudos
Message 3 of 7
(3,457 Views)
Do you graph a waveform data type or a simple 1D array?

Waveform datatypes contain X-axis information, so you could just use "get waveform components" and extract the Y array and feed only that to the graph. On the graph properties, check your x-scale and make sure that the scaling factors are set to [Offset=0, Multipliner=1].
0 Kudos
Message 4 of 7
(3,457 Views)
Halloechen!

altenbach writes:

> Do you graph a waveform data type or a simple 1D array?

I have only a row of data. They are y values, and they should be
plotted simply next to each other.

Tschoe,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
0 Kudos
Message 5 of 7
(3,457 Views)
Torsten,
Well, by default, the x-axis is labeled "time", but you can call it anything you like, or even hide the x-axis entirely. Also check the formatting of your x-axis, make sure it is not set to one of the time formats. Make sure that the offset and multiplier for the x-axis are 0 and 1, resp.

As mentioned above, if you don't want to see the full range including the missing data points, turn off autoscaling and set the x range programmatically from the range of valid data.

Maybe I don't quite understand you problem. Could you attach e.g. a small piece of code or an image?
0 Kudos
Message 6 of 7
(3,457 Views)
Halloechen!

altenbach writes:

> [...]
>
> Maybe I don't quite understand you problem. Could you attach
> e.g. a small piece of code or an image?

Thank you, I finally found my error. Now I do the following:

I initialise two 1D arrays of doubles of the same size. One is set
with the number sequence 1,2,3,..., the other with NaNs. Both enter
a big loop in which my measurements take place. In each cycle, the
NaN array is overwritten with a (smaller) chunk of real data, with
the proper offset as already explained.

At the same time, both arrays are woven into an array of clusters of
two doubles. This is what the xy plot display expects as input.
That's it. Now I see the plot growing while the measurement
happen.


My last error was rather tricky to find for a beginner: The index
array is initialised with 1,2,3,... in a small extra loop. Its
result is sent into the big loop. Unfortunately, by default the
connection points at the loop boundaries have "indexing activated"
(back-translated from German). I de-activated it, and then it
worked. Rather strange feature by the way ...

Tschoe,
Torsten.

--
Torsten Bronger, aquisgrana, europa vetus
0 Kudos
Message 7 of 7
(3,457 Views)