2D line plot with two y-axes not working

Spacerlabs Team on 16 Jul 2022
Latest activity Reply by Christopher Stapels on 25 Jul 2022

Hi,
The template code provided for the visualisation of a '2D line plot with y axis on both left & right side' does not work with my public channel 1789024 and Field 1 and Field 2 data. The axes are drawn and automatically adjust to the number of points which are chosen and the range of data values. But no points are actually plotted ( visible ). I have a free license and two channels in total. Are there license restrictions or can anyone see why the code doesn't work ?
regards,
SpacerLabs
Christopher Stapels
Christopher Stapels on 25 Jul 2022
Your data has many NAN values. Line will connect subsequent real values points with a line, but since yo do not have real valued points that are sequential, they cannot be connected.
Use scatter in place of plot.
yyaxis left;
scatter(time1, data1)
yyaxis right;
scatter(time2, data2);
You can also remove the NaN values:
data1nn=data1(~isnan(data1));
time1nn=time1(~isnan(data1));
data2nn=data2(~isnan(data2));
time2nn=time2(~isnan(data2));
plot(time1nn,data1nn);
plot(time2nn,data2nn);