5.0

5.0 | 2 ratings Rate this file 95 downloads (last 30 days) File Size: 9.25 KB File ID: #11159

fig2cmd

by Ofek Shilon

 

23 May 2006 (Updated 17 Jul 2006)

No BSD License  

fig-file to command-strings converter

Download Now | Watch this File

File Information
Description

command_strings = fig2cmd(figfile,varargin)

This routine is meant for users (like myself) who wish to enjoy the graphical design capabilities of GUIDE, but avoid the large amount of code it generates. The routine takes the figfile and extracts the gui objects (figure, axes, uicontrol etc.) and their properties (position, string, tag, etc.) to a cell arr of valid command strings. These strings can then be pasted in code or even sent to eval.

The routine wasn't tested on all possible gui-objects and configurations, but the basic apparatus should apply to all objects, with little or no adaptation. Please let me know if any gui-objects or props causes problems : ofek@REMOVETHISsimbionix.com

Several modes of operation are available:
    cs = fig2cmd(figfile, proplist) ,
generages the commands reproducing the GUI, with specified props stated explicitly.
    
    cs = fig2cmd(figfile, 'nondefault', ... )
generates commands specifying only nondefault properties among the given ones.
    
    cs = fig2cmd((figfile, 'exclude',...)
generates commands specifying all properties (optionaly 'nondefault') excluding those given as arguments.
    
There is a hard-coded default property list and basic exclude properties.
You can modify them manually at the beginning of the m-file.
    
Example :
    
    cs = fig2cmd('myfig.fig', 'units','position')
    
may produce output similar to -
    
  cs =
  'figure('units','characters','position',[112 31.38462 49 25.15385])'
  'uicontrol('units','characters','position',[6.2 7.23077 33.8 1.30769])'
  'axes('units','characters','position',[5.6 3 36.4 3.84615])'
    
    
  cs = fig2cmd('myfig','nondefault','exclude', 'CData')
    
would generate GUI commands with comprehensive nondefault property list as arguments, excluding the color data of the gui objects.

MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
11 Feb 2007 Andy K

Just what i was looking for. Thanks!

27 Oct 2009 chen li  
Please login to add a comment or rating.
Updates
17 Jul 2006

description typos fixed

Tag Activity for this File
Tag Applied By Date/Time
gui tools Ofek Shilon 22 Oct 2008 08:26:36
example Ofek Shilon 22 Oct 2008 08:26:36
guide gui figure fig command Ofek Shilon 22 Oct 2008 08:26:36
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com