How do I call on a function created outside of the App Editor?
10 views (last 30 days)
Not sure if I am describing my problem correctly, but what I would like to do is call on a script/function I have created when a user presses a button in my app.
For instance, I have a script that will take a use inputted image, run analysis on it, and output the results. Everything works fine when it is run as a script, and so was hoping to port this over to an app, where the use inputs the image, and clicks an "Analyze" button, which would run the script I have created.
This is my first time trying to create an app and I find the documentation very poor. I can't find any information regarding this online.
Stephen23 on 28 Sep 2018
Edited: Stephen23 on 28 Sep 2018
"How do I actually point the App to the script located on my computer?"
Simple, just change the MATLAB Search Path., because that is exactly what the MATLAB Search Path is for:
The Search Path is just a list of directories to tell MATLAB where you have scripts/functions/classes saved, so that it can look for them there. Once you add those directories to the path:
then you can just call those scripts/functions normally. Programming languages require a search path because looking everywhere for functions or scripts is
- very slow
"Is there a way to store the scripts within the app itself??"
Probably you could convert them to functions and include them in the same file, but this is unlikely to be a good idea: keeping functions and scripts in functionally distinct categories and directories makes management and maintenance much easier. I doubt that it would help you to put everything into one big file.