fig2cmd

版本 1.0.0.0 (3.1 KB) 作者: Ofek Shilon
fig-file to command-strings converter
2.0K 次下载
更新 2006/7/17

无许可证

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.

引用格式

Ofek Shilon (2026). fig2cmd (https://ww2.mathworks.cn/matlabcentral/fileexchange/11159-fig2cmd), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2006a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Interactive Control and Callbacks 的更多信息
版本 已发布 发行说明
1.0.0.0

description typos fixed