user define dialog box or GUI
7 views (last 30 days)
Show older comments
Hi all,
I wrote a function in Matlab that asks input from the user. I used this script and similar four times:
prompt = {'Enter the Value of a on SIDE 2','Enter the Value of b on SIDE 2','Enter the Value of c on SIDE 2'};
dlgtitle = 'Calculate ZReal - ZReal=a(Z[V])^2+b*(Z[V])+c';
definput = {'6.1101e-9','-2.3062e-04','17.372'};
opts.Interpreter = 'tex';
temp = inputdlg(prompt,dlgtitle,[1 140],definput,opts);
a=str2num(temp{1});
b=str2num(temp{2});
c=str2num(temp{3});
This dialog box do the job, but I'm looking for something easier and nicer. I thought about using GUI, but I don't know how to start the GUI from a function, get the data and close the GUI.
I will appreciate your help.
Thanks.
0 Comments
Accepted Answer
Rik
on 7 May 2020
Easier and nicer might be mutually exclusive.
3 Comments
Rik
on 7 May 2020
- Look through the documentation page with the uicontrol properties. There are a lot of them, and I know at least the size can be changed, I would have to look up Color.
- No, but you can set the String property when you create the element to anything you like, which I would argue is the same effect as a default.
- With some of the uicontrol styles you can set the Max property to something higher than 1 and set a cell array as the String property to have multiple lines of text. You can even set Max to inf. Note that for an edit field this will stop the callback from working as intended.
Glad to be of help.
If my answer solved your issue, please consider marking it as accepted answer.
More Answers (0)
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!