File Exchange

image thumbnail

StructDlg - Structure based GUI definition

version 1.0 (634 KB) by

A structure based definition of an input GUI.

13 Ratings



View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

StructDlg creates a modal dialog box that contains a user interface (UI) control for each of the input structure fields. In its simple form, StructDlg serves as a structure-based alternative to INPUTDLG and it is a convenient method for browsing and changing structure values (e.g. when the structure contains parameters).
In its advanced form, StructDlg allows for a quick and convenient text based definition of a GUI that may contain many styles of UI controls such as edit, popup menus, radio buttons, toggles and more.

Detailed examples are given in an HTML doc file.

Comments and Ratings (14)

David Cooper

Ben Petschel

Nice tool, though I encountered an obscure bug that froze matlab when I passed it a bad input, e.g. S.a={{true}};StructDlg(S)

To close it without killing matlab had to press Ctrl-C (to restore command-line access) then type closereq (because the usual CloseRequestFcn is overridden).

Gerd Kunert


nice tool. One wish:
I would like to have a multi line edit box.
For example for a GUI where the user can enter a comment field with several lines.

Eduard Rudyk

Excellent toolbox!


Mais (view profile)

thats so awesome !!!

very useful tool and very easy to handle with.
saves so much time when creating GUIs to input data.
(why wasn't this a "pick of the week" ?)

Andrew Blackburn

Extremely useful time-saving code. Saved a whole day's worth of work.

Kynan Graves

Very Handy. Saves a lot of development time.

Niels Smaby

Amazing tool - huge time saver and slick!

Wojtek Grabski

Jorge Otero-Millan

That's an awsome script and really really usefull to develop guis fast.
Just one comment. The checkboxes appeard cuted in the left in my computer.
I changed the file StructDlg in the line 1067
      'position', [lbl_pos(3)+lbl_pos(1)+0.5 lbl_pos(2) 3 1.5],...

I put a 3 where used to be a 2 and now it looks fine for me.

Thanks a lot!


Joe Lotz

Excellent! This has made GUI creation very easy. I used it and it has worked great.

Chris Cannell

This is a great script. One thing you may want to add. Right now fieldnames are parsed into separate words for use as labels using only underscore. You may want to add parsing for camelCaps. I prefer camelCaps to underscores for separating words in variable names. I added this functionality for my use. You can add:

fnames_lbl = regexprep(fnames,'([A-Z])',' $1');
for i=1:length(fnames_lbl)
    fnames_lbl{i} = [upper(fnames_lbl{i}(1)) fnames_lbl{i}(2:end)];

after line 428 in StructDlg.m. Thanks for the great script.

Roger Jeurissen

This function does what it claims (and the cancel button seems to have been added). Thank you.

Heiko Marx

Very nice! Allows highly structured but easy to build input dialogs. Two negative points though: I got error an message when I closed the GUI with the close button (x). There is no 'Cancel' button. Second: There is an option to give a GUI position and size which is not documented but might (as in my case) be helpful for a desired performance. Thank you for this tool!!!


This version fixes a bug that crashed StructDlg when substructures were used.
Additionally, StructDlg allows now for auto-updates even when the referenced field is not a numeric field.

MATLAB Release
MATLAB 7.0.1 (R14SP1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video