structdlg: a dialogue to edit structures

版本 1.0.2.0 (8.5 KB) 作者: Emmanuel Farhi
A dialogue is built to display editable fields from a structure
104.0 次下载
更新时间 2017/6/21

查看许可证

structdlg: a dialogue which allows to modify structure(s) in a table

In modal (default) creation mode, the updated structure is returned upon
closing the window. A modal dialog box prevents a user from interacting
with other windows before responding to the modal dialog box.
In non-modal creation mode, the window is displayed, and remains visible
while the execution is resumed. The call to structdlg returns a
configuration which should be used as follows to retrieve the modified
structure later:
ad = structdlg(a, struct('CreateMode','non-modal'));
% continue execution, and actually edit and close the window
% ...
% get the modified structure (when closing window)
Data = getappdata(0,ad.tmp_storage); fields=Data(:,1); Data=Data(:,2:end);
new_a = cell2struct(reshape(Data, ad.size), fields, 1);
rmappdata(0, ad.tmp_storage);

input:
structure: the initial struct to edit
options: a set of options, namely:
options.Name: the name of the dialogue (string)
options.FontSize: the FontSize used to display the table
default: use the system FontSize.
options.ListString: the labels to be used for each structure field (cell).
the cell must have items 'fieldname description...'
default: use the structure member names.
options.TooltipString: a string to display (as help)
options.CreateMode: can be 'modal' (default) or 'non-modal'.
options.Tag: a tag for the dialogue.
options.CloseRequestFcn: a function handle or expresion to execute when
closing the dialogue in 'non-modal' mode.

output:
structure: the modified structure in 'modal' mode (default),
or the dialogue information structure in 'non-modal' mode.

Example:
a.Test=1; a.Second='blah'; structdlg(a)
options.ListString={'Test This is the test field','Second 2nd'};
structdlg([a a], options);

Version: June 2017
(c) E.Farhi, ILL. License: BSD. <ifit.mccode.org>

引用格式

Emmanuel Farhi (2024). structdlg: a dialogue to edit structures (https://www.mathworks.com/matlabcentral/fileexchange/61092-structdlg-a-dialogue-to-edit-structures), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2010a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Maintain or Transition figure-Based Apps 的更多信息
致谢

参考作品: class2str

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.2.0

screenshot

1.0.1.0

Update to non-modal mode.

1.0.0.0