From: Oluyemi on
I have a standalone application in form of a GUI that lets users input function files as .m files
And i want to be able to evaluate their functions with parameters that they supply in the GUI.
Is there a way this can be done?
From: James Tursa on
"Oluyemi " <zgbenga(a)yahoo.ca> wrote in message <hodsuh$jqu$1(a)fred.mathworks.com>...
> I have a standalone application in form of a GUI that lets users input function files as .m files
> And i want to be able to evaluate their functions with parameters that they supply in the GUI.
> Is there a way this can be done?

If MATLAB is available then you could use a MATLAB engine for this. e.g., Get the function name from the user, use engEvalString to evaluate the function, and then get the results into your app. How were you planning on dealing with the inputs and outputs of the function with respect to the user?

James Tursa
From: Oluyemi on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hoe7pc$9gh$1(a)fred.mathworks.com>...
> "Oluyemi " <zgbenga(a)yahoo.ca> wrote in message <hodsuh$jqu$1(a)fred.mathworks.com>...
> > I have a standalone application in form of a GUI that lets users input function files as .m files
> > And i want to be able to evaluate their functions with parameters that they supply in the GUI.
> > Is there a way this can be done?
>
> If MATLAB is available then you could use a MATLAB engine for this. e.g., Get the function name from the user, use engEvalString to evaluate the function, and then get the results into your app. How were you planning on dealing with the inputs and outputs of the function with respect to the user?
>
> James Tursa


The standalone application was built from a My.fig file, its accompaning My.m file and then a MyProc.mexw32 file that does the real job of processiing a user input function User.m to form a practically close approximation to it. From the Matab workspace, i can work with the four files and edit User.m to examine various functions; but when i create a standalone application My.exe from the 3 files: My.fig, My.m and MyProc.mexw32, the standalone application gives error "Undefined function or method" even with User.m in the same directory as My.exe
(The output of My.exe would be graphs comparing the user defined function with my approximation).
I want to be able to deploy My.exe to users and let them define their function User.m to examine.
MyProc.mexw32 was formed from MyProc.cpp which contains the line for processing the User.m:
mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,"User");
How do I achieve this?
Thanks
From: Steven Lord on

"Oluyemi " <zgbenga(a)yahoo.ca> wrote in message
news:hoeaa1$fli$1(a)fred.mathworks.com...
> "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message
> <hoe7pc$9gh$1(a)fred.mathworks.com>...
>> "Oluyemi " <zgbenga(a)yahoo.ca> wrote in message
>> <hodsuh$jqu$1(a)fred.mathworks.com>...
>> > I have a standalone application in form of a GUI that lets users input
>> > function files as .m files
>> > And i want to be able to evaluate their functions with parameters that
>> > they supply in the GUI.
>> > Is there a way this can be done?
>>
>> If MATLAB is available then you could use a MATLAB engine for this. e.g.,
>> Get the function name from the user, use engEvalString to evaluate the
>> function, and then get the results into your app. How were you planning
>> on dealing with the inputs and outputs of the function with respect to
>> the user?
>>
>> James Tursa
>
>
> The standalone application was built from a My.fig file, its accompaning
> My.m file and then a MyProc.mexw32 file that does the real job of
> processiing a user input function User.m to form a practically close
> approximation to it. From the Matab workspace, i can work with the four
> files and edit User.m to examine various functions; but when i create a
> standalone application My.exe from the 3 files: My.fig, My.m and
> MyProc.mexw32, the standalone application gives error "Undefined function
> or method" even with User.m in the same directory as My.exe
> (The output of My.exe would be graphs comparing the user defined function
> with my approximation).
> I want to be able to deploy My.exe to users and let them define their
> function User.m to examine.
> MyProc.mexw32 was formed from MyProc.cpp which contains the line for
> processing the User.m:
> mexCallMATLAB(nlhs1,plhs1,nrhs1,prhs1,"User");
> How do I achieve this?

You can't, as this section from the documentation for MATLAB Compiler
explains:

http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/bsfez67.html#bsf4mga

The compiled application can ONLY run code that was included when the
application was compiled.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Oluyemi on
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hoe7pc$9gh$1(a)fred.mathworks.com>...
> "Oluyemi " <zgbenga(a)yahoo.ca> wrote in message <hodsuh$jqu$1(a)fred.mathworks.com>...
> > I have a standalone application in form of a GUI that lets users input function files as .m files
> > And i want to be able to evaluate their functions with parameters that they supply in the GUI.
> > Is there a way this can be done?
>
> If MATLAB is available then you could use a MATLAB engine for this. e.g., Get the function name from the user, use engEvalString to evaluate the function, and then get the results into your app. How were you planning on dealing with the inputs and outputs of the function with respect to the user?
>
> James Tursa


I tried using your engCallMatlab
k = engCallMATLAB(ep,nlhs1,plhs1,nrhs1,prhs1,"user_defined");
in the .cpp file (testfunction.cpp) that handles the user defined functions.
Next i tried compiling and linking my .cpp files to get a new MyProc.mexw32
mex -v -output MyProc *.cpp
The compiling seems to complete successfully but the linking fails with the following 3 errors
1. testfunction.obj : error LNK2019: unresolved external symbol _engGetVariable referenced in function "int __cdecl engCallMATLAB(struct engine *,int,struct mxArray_tag * * const,int,struct mxArray_tag * * const,char const *)" (?engCallMATLAB@@YAHPAUengine@@HQAPAUmxArray_tag@@H1PBD@Z)
2. testfunction.obj : error LNK2019: unresolved external symbol _engEvalString referenced in function "int __cdecl engCallMATLAB(struct engine *,int,struct mxArray_tag * * const,int,struct mxArray_tag * * const,char const *)" (?engCallMATLAB@@YAHPAUengine@@HQAPAUmxArray_tag@@H1PBD@Z)
3. testfunction.obj : error LNK2019: unresolved external symbol _engPutVariable referenced in function "int __cdecl engCallMATLAB(struct engine *,int,struct mxArray_tag * * const,int,struct mxArray_tag * * const,char const *)" (?engCallMATLAB@@YAHPAUengine@@HQAPAUmxArray_tag@@H1PBD@Z)
I can't figure out what's wrong
Please do you have any suggestions