I have a working MATLAB program measures data to tune a machine in real-time using the SOAP library from MATLAB (several measurements per second). It was working well, updating two figures, each containing four sub-plots as the tuning proceeds. Recently the plot has stopped updating, just showing a grey box (actually two shades of grey if you re-size the window).
I can tell that the program is running properly from debug information written to the MATLAB console. Also, sometimes the plots update in a burst, adding many new points, when they should be updating with every new point.
I have made several small changes to the code to reduce the comms traffic, but my biggest recent change is to all lots of calls to toc to measure the time taken in various parts of the code, with a single tic at the start.
Is it possible these extra timing calls could be suppressing the plots?
Here is a cut down copy of my code. It is a nested function that makes use of some configuration data from the top level function. The figure is one of two created in the top level function then completely redrawn as new data arrives.
function acc_plot(accFig, accData)
figure(accFig);
sp1 = '221';
% Plot current vs raw position
subplot(sp1);
plot(xRawPos,yCfbDcM,'r.', xRawPos,yCfbDcP,'b.')
hold on;
if tuneConfig.dualSensors(accData.axisIx)
plot(xRawPosB,yCfbDcM,'g.', xRawPosB,yCfbDcP,'m.')
end
title(['acc check ' tuneConfig.axisNames{accData.axisIx}])
ylabel('CFBM(r)/CFBP(b) [A]')
xlabel(xPosLabel)
grid on
end