how to send Matlab app (.mlapp) file data and Matlab function (.m)

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

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?
I am sorry I did not clarify about the callback function. Yes, I am using a callback function to call that external function.
After every inputs have been selected, the user will press a button to analyze. There I have created a callback function to call the outside function. After choosing the analysed button, the outside function is running, but the function stopped running with errors.
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.
Here is a part of the outside function I am having the error:
[Units, PCCMat, SoilMat, PCCPlate, PCCLaminate, Sections, NSlabsX, NSlabsY, DimX, MaxDX, DimY, MaxDY, Friction, EllipseSelectSections, QuadrangleSelectSections, EllipseSelectDepression, QuadrangleSelectDepression, CRCProp, LSteelProp, TSteelProp, LongLocation, TransLocation, steel_depth, CriticalArea, JointTypeX, JointTypeY, KeyJointStiffnessX, KeyJointStiffnessY, JointSpaceX, JointSpaceY, DowelProperties, XDowelsCoord, XDowelsID, XDowelsJointID, XDowelsLayerID,YDowelsCoord, YDowelsID, YDowelsJointID, YDowelsLayerID, NodesWithForce, NodalForces, PointForces, PointForcesX, ElemsWithDistLoad, ElemsDistLoad, TireContactPressure, TireContactCenter, TireContactDim, TireMoveDX, NTireMovements, TempDepth, TempProfile]=DefineSections(param);
After this line of execution, I am getting following message:
Cannot access method 'DefineSections' in class 'App_Latest'.
In the app, I have called the outside function, named RPAS.m, like folowing:
RPAS(app);
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.

Sign in to comment.

Answers (1)

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

Asked:

on 5 Mar 2023

Commented:

on 6 Mar 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!