Here's how I read in formatted text, ignoring all lines that start with '#'
[cpu0usr cpu0sys cpu0idle cpu1usr cpu1sys cpu1idle] = textread(inputfile,'%u %u %u %u %u %u', -1, 'commentstyle', 'shell');
Here's how I'd graph this stuff (in 3d):
subplot(1,2,1), plot3(time,z0, cpu0usr, '', time, z0+1, cpu0sys, '', time,z0+2, cpu0use, ''), ...
xlabel('time(s)'), zlabel('% utilization'),title('CPU0'), ...
legend('CPU 0 usr (0)', 'CPU 0 sys (1)', 'CPU 0 usage (2)'), ...
grid on, axis([0 max(time) -0.5 +2.5 0 100]), ...
view([-15 15]), axis square, shading interp, zoom(1.7);
Here's how to write it to a file:
I = getframe(gcf);
newfilename = sprintf('%s.png',filetoprocess);
fprintf('Writing to file %s...', newfilename);
imwrite(I.cdata, newfilename);
Here's some useful graphing stuff:
orient landscape portrait - orient the page
clf reset - clear the screen completely... none of this leaving text behind stuff
set(gcf, 'Color', [1 1 1]); - set the background color to white
And finally, putting up text non interactively. This is actually not so easy-- you need to create an axes in order to create text. So if we want to put text outside of the existing axes, we have to make an invisible axes and then put visible text in it. Got it? Here's some code for you...
function thandle = puttext(usertext, userpos, textsize)
% Textsize is same as word
% Userpos is a 1x2 or 1x3 array where each value x is 0<= x <=1
% Usertext is uh text.
% set h0 to the handle of the current figure
h0 = gcf;
% create invisible axes to put a text control inside of
h1 = axes('Parent',h0, ...
'CameraUpVector',[0 1 0], ...
'Color','none', ...
'CreateFcn','', ...
'HandleVisibility','off', ...
'HitTest','off', ...
'Position',[0 0 1 1], ...
'Tag','ScribeOverlayAxesActive', ...
'Visible','off', ...
'XColor',[0.8 0.8 0.8], ...
'XLimMode','manual', ...
'XTickMode','manual', ...
'YColor',[0.8 0.8 0.8], ...
'YLimMode','manual', ...
'YTickMode','manual', ...
'ZColor',[0 0 0]);
% create the text control
h2 = text('Parent', h1, ...
'Color',[0 0 0], ...
'FontSize',textsize, ...
'Position',userpos, ...
'String',usertext);
% return the handle of the text control
puttext = h2;
return
Subscribe to:
Post Comments (Atom)
Labels
- Java (34)
- Oracle (27)
- javascript (24)
- NIX administration (19)
- Reporting (18)
- XML (17)
- Web Graphics (10)
- perl (10)
- CSS (9)
- Tomcat (8)
- Android (7)
- Matlab (7)
- XSL (7)
- HTML (6)
- SQL (6)
- XForms (6)
- browser quirks (6)
- Orbeon XForms (5)
- Solaris (5)
- AJAX (4)
- Mirth Project (4)
- PHP (4)
- Video (4)
- Arduino (3)
- Eclipse (3)
- JPA (3)
- JSP (3)
- JSTL (3)
- LAMPS (3)
- SSH (3)
- SVN (3)
- Hibernate (2)
- Netbeans (2)
- Networking (2)
- Python (2)
- Windows (2)
- Wordpress (2)
- XHTML (2)
- Alfresco (1)
- Architecture (1)
- ArduPilot (1)
- Arduino Yun (1)
- Arduplane (1)
- Audio Recording (1)
- Betaflight (1)
- CouchDB (1)
- DIY (1)
- Design (1)
- FPV (1)
- JSON (1)
- JUnit (1)
- Mobile Development (1)
- Printing (1)
- RC Airplane (1)
- REST (1)
- Scalability (1)
- Struts (1)
- Tools (1)
- Virtualization (1)
- Web services (1)
- camera (1)
- canon (1)
- gphoto2 (1)
- jQuery (1)
- ubuntu (1)
- unix (1)
No comments:
Post a Comment