Matlab tools: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
(Created page with '=== Figure Positioning Tool === Description: A tool facilitate positioning of figures on a certain location on the screen. Usage:Position the figure with number ''fignr'' at a d…')
 
No edit summary
Line 1: Line 1:
=== Figure Positioning Tool ===
=== Figure Positioning Tool ===
Description: A tool facilitate positioning of figures on a certain location on the screen.  
====Description:====
Usage:Position the figure with number ''fignr'' at a desired location. Run the function pos(''fignr'') in the command prompt of matlab. This will copy a command similar to ''set(1,'position',[1400 530 560 420]);'' to your clipboard. Next, paste this line after the figure(''fignr''); command in your m-file. The next time you run the m-file, the figure will be positioned at the desired location.
A tool to facilitate positioning of figures on a certain location on the screen.  
 
====Usage:====
Position the figure with number ''fignr'' at a desired location. Run the function pos(''fignr'') in the command prompt of matlab. This will copy a command similar to ''set(1,'position',[1400 530 560 420]);'' to your clipboard. Next, paste this line after the figure(''fignr''); command in your m-file (use CTRL-V!). The next time you run the m-file, the figure will be positioned at the desired location.
 
File: pos.m
File: pos.m
Code:
Code:
function pos(fig)
function pos(fig)
posvec=get(fig,'position');
posvec=get(fig,'position');
clipboard('copy', ['set(',num2str(fig),',''position'',[',num2str(posvec(1,1)),' ',num2str(posvec(1,2)),' ',num2str(posvec(1,3)),' ',num2str(posvec(1,4)),']);'  ])
clipboard('copy', ['set(',num2str(fig),',''position'',[',num2str(posvec(1,1)),' ',num2str(posvec(1,2)),' ',num2str(posvec(1,3)),' ',num2str(posvec(1,4)),']);'  ])
disp(['Clipboard contains: ' clipboard('paste')]);
disp(['Clipboard contains: ' clipboard('paste')]);
disp('Paste this after your figure(fig); command in your m-file.');
disp('Paste this after your figure(fig); command in your m-file.');

Revision as of 11:56, 28 April 2011

Figure Positioning Tool

Description:

A tool to facilitate positioning of figures on a certain location on the screen. 

Usage:

Position the figure with number fignr at a desired location. Run the function pos(fignr) in the command prompt of matlab. This will copy a command similar to set(1,'position',[1400 530 560 420]); to your clipboard. Next, paste this line after the figure(fignr); command in your m-file (use CTRL-V!). The next time you run the m-file, the figure will be positioned at the desired location.

File: pos.m

Code:

function pos(fig)

posvec=get(fig,'position');

clipboard('copy', ['set(',num2str(fig),',position,[',num2str(posvec(1,1)),' ',num2str(posvec(1,2)),' ',num2str(posvec(1,3)),' ',num2str(posvec(1,4)),']);' ])

disp(['Clipboard contains: ' clipboard('paste')]);

disp('Paste this after your figure(fig); command in your m-file.');