MATLAB Answers

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

3 views (last 30 days)
Hayeong Oh on 13 Jan 2020
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 Comments

Sign in to comment.

### Answers (0)

Sign in to answer this question.

Translated by