Clear Filters
Clear Filters

Including functions in App Designer

2 views (last 30 days)
Luk kim
Luk kim on 18 Dec 2017
Answered: Melissa Williams on 24 Jan 2018
Hello, I'd like to make a simple app using App Designer that would take user input for three variables via numeric edit field and when the button is pushed it plots ode45 solution on UIAxis.
I have a function that works in Matlab (attached to the post as lqe.m) that you run by using this two lines of code
[t,y]=ode45(@lqe, [0 1200], [1 0]);
plot (t,y)
Now, I'd like to make GUI in App Designer as mentioned above. I've only made simple apps that haven't required using long functions like this one. I've tried putting the function in methods section of App Designer but it didn't work. My AppDesigner file is attached as LQ.zip, if you want to look at it. I'm using 2016a version of Matlab.
If anyone could point me in right direction I'd really appreciate it.

Answers (1)

Melissa Williams
Melissa Williams on 24 Jan 2018
Luk, Putting the function in the methods block of the app is one option, another is just calling the external function from the app. If you put it in the methods block of the app, you will need to pass app as the first input argument.
In the app you attached, you are missing some app properties and also not passing enough input arguments when calling lqe.
-Melissa

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!