How can I plot separately(should I use yyaxis?) at real time Data acquisition ?

1 次查看(过去 30 天)
How can I plot separately(yyaxis?) at real time Data acquisition ?
I edited original code to use [ 1 Force input(DC signal) and 2 acceleration input('Accelerometer') ].
But, yyaxis doesn't work with this code(Below is simplified code just for checking yyaxis);
When just postprocessing data at Captured data axis, I could manage to graph yyaxis ( with plot function, not 'set(hGui.LivePlot(1),'Xdata',~~~' ) .
but in Live plot, it was not possible.
function figtest
hGui = createDataCaptureUI();
hGui.Axes1
yyaxis (hGui.Axes1,'right')
set(hGui.LivePlot(1),'Xdata',b(:,1),'Ydata',b(:,2))
yyaxis (hGui.Axes1,'left')
b=[1 10 3 4
2 5 5 6
3 2 8 9];
for ii=2:3
set(hGui.LivePlot(ii),'XData',b(:,1),'YData',b(:,ii))
end
end
function hGui = createDataCaptureUI()
% Create a figure and configure a callback function (executes on window close)
hGui.Fig = figure('Name','Software-analog triggered data capture', ...
'NumberTitle', 'off', 'Resize', 'off', 'Position', [100 10 750 650]);
% set(hGui.Fig, 'DeleteFcn', {@endDAQ, s});
uiBackgroundColor = get(hGui.Fig, 'Color');
% Create the continuous data plot axes with legend
% (one line per acquisition channel)
hGui.Axes1 = axes;
hGui.LivePlot = plot(0, zeros(1, 3));
xlabel('Time (s)');
yyaxis (hGui.Axes1,'right'); ylabel('R(N)');ylim([-3 3])
yyaxis (hGui.Axes1,'left'); ylabel('L(acc)');ylim([-10 10])
title('Continuous data');
% legend(get(s.Channels, 'ID'), 'Location', 'northwestoutside')
set(hGui.Axes1, 'Units', 'Pixels', 'Position', [207 391 488 196]);
grid on
% Create the captured data plot axes (one line per acquisition channel)
hGui.Axes2 = axes('Units', 'Pixels', 'Position', [207 99 488 196]);
hGui.CapturePlot = plot(NaN, NaN(1, 3));
xlabel('Time (s)');
ylabel('Voltage (V)');
title('Captured data');
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by