How to make a button in AppDesigner launch a matlab script ?

Hello!
I am trying make a button in app designer that will launch a matlab script that I wrote before. I have already created a button, but I don't know how to code this in my ButtonPushed button..
Thanks for helping !

 Accepted Answer

Hello,
See run function.

7 Comments

Thank you, it helps a lot!
However, the data that I calculate do not appear in the workspace (I'd like to import these data in app designer after the calculations). do you have any tips for that?
You can:
  • save your workspace (or variables only) and use load function within App Designer
  • convert your script to function that outputs the needed results
Thank you again! I'll try that..
I wanted to try to run the matlab script outside appdesigner, because I feared that it would be very long if I put the script in a function (the app is very very slow on my computer).
I think the timing will be very similar regardless whether the file is a function or a script. App is very slow? What does your app do? Only slowness that might be caused is related to plotting the functions many many times.
It displays images like a movie, so I'm sure that the slowness comes from here. But if the timing is similar, I'll put all the script in a function!
You can try external figure window, as opposed to uifigure (the one that AppDesigner uses). Having two different elements is not so nice estetically, but if you care about performance, then it's fine.

Sign in to comment.

More Answers (0)

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!