image thumbnail
from System Information Class for Windows by Xin Zhao
This class will query the current system information in MATLAB. Works with R2009a and up.

stopRecordAndDisplay.m
stop(t);

x1 = perfData.TimeArray;
x2 = x1;
y1 = perfData.UsedMemoryArray;
y2 = perfData.UsedCPUArray;

fig = figure;
% Plot first plot
ax(1) = gca;
set(fig,'NextPlot','add');

lineWidth = 2;
color1 = 'b';

h1 = plot(ax(1),x1,y1, color1);
set(ax(1),'Box','on', 'YColor', color1);
set(h1, 'LineWidth', lineWidth);
datetick(ax(1),'x', 'HH:MM:SS');
ylabel(ax(1), sprintf('Memory Used (%s)', perfData.UsedMemoryUnits));
% Create second axes

ax(2) = axes('HandleVisibility',  get(ax(1),'HandleVisibility'), ...
             'Units',             get(ax(1),'Units'), ...
             'Position',          get(ax(1),'Position'), ...
             'Parent',            get(ax(1),'Parent'));

color2 = 'r';
h2 = plot(ax(2),x2,y2, color2);
set(h2, 'LineWidth', lineWidth);
set(ax(2), ...
    'YColor', color2, ...
    'YAxisLocation', 'right',...
    'Color',         'none', ...
    'XGrid','off','YGrid','off','Box','off');

datetick(ax(2),'x', 'HH:MM:SS');
grid(ax(2), 'on');
ylabel(ax(2), sprintf('CPU Used (%s)', perfData.UsedCPUUnits));

Contact us