user define dialog box or GUI

5 visualizaciones (últimos 30 días)
Idan Cohen
Idan Cohen el 7 de Mayo de 2020
Editada: Idan Cohen el 8 de Mayo de 2020
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.

Respuesta aceptada

Rik
Rik el 7 de Mayo de 2020
Easier and nicer might be mutually exclusive.
If you want tips and examples about GUI design, I encourage you to check out this thread.
  3 comentarios
Rik
Rik el 7 de Mayo de 2020
  1. 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.
  2. 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.
  3. 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.
Idan Cohen
Idan Cohen el 8 de Mayo de 2020
Editada: Idan Cohen el 8 de Mayo de 2020
The way to do that, if someone will read, for question 1 (2 and 3, still working to find the answer)
You specify one of the uicontrol as variable:
test==uicontrol('Style','Text',...
'Units','Normalized',...
'Position',[0.05 .55 .1 .1],...
'String','Enter a',...
'FontSize',[12],...
'CallBack','uiresume(gcbf)');
for color - set(a1_text,'ForegroundColor','blue');
for bold - set(Side_1,'FontWeight','bold');

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by