how to send Matlab app (.mlapp) file data and Matlab function (.m)
Show older comments
I have a MATLAB fucntion which is supposed to use data from a MATLAB GUI input. But I am having trouble reading the data from an outside function. While I am calling the function (.m file) from the interfase, the fucntion is running but receiving the data from the edit fields. Can anybody give me a probable solution for reading inputted data and used in a function outside the user interfase?
Thanks in advance.
5 Comments
Rik
on 5 Mar 2023
It doesn't sound like you are using callback functions to call that external function. Can you confirm that? And if so, can you explain why you aren't?
Samina Samrose
on 5 Mar 2023
Steven Lord
on 5 Mar 2023
It would be easier to diagnose the problem if you show us the full and exact text of any warning and/or error messages you receive (all the text displayed in orange and/or red in the Command Window) as well as a small sample of code. The callback function, the line of code where you set the callback function on the button that calls it, and the outside function each could be relevant.
Samina Samrose
on 5 Mar 2023
chrisw23
on 6 Mar 2023
reading inputted data and used in a function outside
The 'outside' function must be in the matlab search path. So either use a session path (addpath command) or just place the function .m file in a special folder named 'private' beside your GUI file (*.mlapp).
Pass the app handle will give full access to the edit field values of the GUI, but you can also pass just the values needed.
Answers (1)
Walter Roberson
on 5 Mar 2023
0 votes
You have defined your method DefineSections as being either private or protected . Such methods cannot be called from outside the class (or sometimes a subclass.)
You will either need to make the method public directly, or else you will need to create a public method that gets called instead.
Categories
Find more on Data Import and Export 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!