Edit Field Box Values in matlab app designer are not updating.

조회 수: 10 (최근 30일)
Michail Kanoupakis
Michail Kanoupakis 2020년 11월 17일
댓글: Image Analyst 2025년 5월 2일
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
Zakary Woodley
Zakary Woodley 2022년 7월 27일
So, how did you do it?
Michael
Michael 2022년 8월 27일
yes.. how did you do this?

댓글을 달려면 로그인하십시오.

답변 (1개)

Divyam
Divyam 2025년 5월 2일
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
Image Analyst
Image Analyst 2025년 5월 2일
And make sure you used a "numeric" edit field, not a "Text" edit field for your frequency threshold fields.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Performance and Memory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by