Driving data from GUI application to the matlab script
조회 수: 3 (최근 30일)
I am building a GUI application using App Designer. A button on the GUI invokes .m script(through callback) that has certain variables hard-coded and are used for the
execution of the script. These are the same variables I would want to drive through GUI(edit number field) to let the user decide the values and see the impact in results.
Let's say X is a variable within .m script and I want to change it through GUI. Tried this:
In .m script:
Before X is defined, added below line
app = app1; (app1 is the name of my GUI Application)
X = app.y; (where y is defined as a public property with no default values assigned in the GUI application)
In GUI application:
properties (Access = public)
app.y = app.X_EditField.Value; (X_EditField is created as an entry using the Edit Field(Numeric) from Component Library)
What am I doing wrong?
Yongjian Feng 2021년 11월 18일
Why don't you create your matlab script as a function and then take y as an input argument?
% whatever your script needs to do with y
Put this function in the same location of your app or in a folder of matlab path, then in your app you can just call it