Edit Field Box Values in matlab app designer are not updating.
Mostrar comentarios más antiguos
I am buildling a GUI app through Matlab app designer but despite the change of the EditFieldBox.Value the value is not updating, so when I am running a .m file through the .mlapp the values that are being loaded to the file are the default values of the edit field box.
I would like the program to behave like that... when I'm pressing the button "Run" of the app and the pop up "UI Figure" window appears, the values that I put/change on the edit field boxes to be passed as a parameter to the .m file (and not passing the default values of the edit field boxes that are already there).
for example some of my parameters in the .m file are these :
fmin = myApp.fminEditField.Value; %high pass filtering frequency
fmax = myApp.fmaxEditField.Value; %low pass filtering frequency
5 comentarios
Mario Malic
el 17 de Nov. de 2020
Editada: Mario Malic
el 17 de Nov. de 2020
Actually, there might be a better idea, if you only intend to use the app to change three variables.
prompt = {'Enter value for var1:','Enter value for var2:', 'Enter value for var3:'};
dlgtitle = 'Input';
dims = [1 35];
definput = {'0','0','0'};
answer = inputdlg(prompt,dlgtitle,dims,definput)
Answer is a cell, with character arrays, so use str2num to convert to numeric values.
Otherwise, show how you call functions
function results = FunName(?)
and similarly, how do you proceed when you press start button.
Han Lee
el 10 de Dic. de 2020
I have the same question here and I have a lot of cell to update.
Do you know a way to update all EditField Text Value?
Thanks!
Han Lee
el 10 de Dic. de 2020
I just figured it out
It's the run function, I make the input of my function linked to run button be the class instead of an object, so everytime it would creat a new class with default value. After I changed the input to an object the problem is solved.
Zakary Woodley
el 27 de Jul. de 2022
So, how did you do it?
Michael
el 27 de Ag. de 2022
yes.. how did you do this?
Respuestas (1)
Divyam
el 2 de Mayo de 2025
To ensure that you pass the updated values to the '.m' script, you need to read the values of the components inside the callback function and then pass these values to the function in your '.m' script. Here is some sample code to help you with the same:
% Button pushed function: RunButton
function RunButtonPushed(app, event)
fmin = app.fminEditField.Value;
fmax = app.fmaxEditField.Value;
% Now call your .m file function, passing these values
% For example, if your .m file is a function:
myMATLABFunction(fmin, fmax);
end
If you try to read the values of the components from the base workspace or from the app object outside the callback, you will only get the default value for that component.
1 comentario
Image Analyst
el 2 de Mayo de 2025
And make sure you used a "numeric" edit field, not a "Text" edit field for your frequency threshold fields.
Categorías
Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!