From: James Tursa on 27 Mar 2010 11:42 "Oluyemi " <zgbenga(a)yahoo.ca> wrote in message <hol70l$h25$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 > > > 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 This is not how to make an engine application. You need to use a bat file from the appropriate directory. e.g., for MSVC you might do this to compile a single file MyProc.cpp into a MyProc.exe executable: options = [matlabroot '\bin\win32\mexopts\msvc80engmatopts.bat']; mex('-f', options, '-v', 'MyProc.cpp'); Then run it like this: !MyProc If you have more than one source file then just string them out as additional arguments in the mex command. e.g., mex('-f', options, '-v', 'file1.cpp', 'file2.cpp', 'file3.cpp'); By default, the executable name will be taken from the first cpp file in the list. James Tursa
From: Oluyemi on 28 Mar 2010 14:49 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hol90d$f72$1(a)fred.mathworks.com>... > "Oluyemi " <zgbenga(a)yahoo.ca> wrote in message <hol70l$h25$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 > > > > > > 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 > > This is not how to make an engine application. You need to use a bat file from the appropriate directory. e.g., for MSVC you might do this to compile a single file MyProc.cpp into a MyProc.exe executable: > > options = [matlabroot '\bin\win32\mexopts\msvc80engmatopts.bat']; > mex('-f', options, '-v', 'MyProc.cpp'); > > Then run it like this: > > !MyProc > > If you have more than one source file then just string them out as additional arguments in the mex command. e.g., > > mex('-f', options, '-v', 'file1.cpp', 'file2.cpp', 'file3.cpp'); > > By default, the executable name will be taken from the first cpp file in the list. > > James Tursa Thank you so much James I've gottn it now thanks to ur last two posts I created an executable MyProc.exe (with mex('-f',options,'-v','all my cpp files') ) that reads user supplied input tolerance values from a file user_input.txt and the calls the matlab engine using engCallMatlab to execute the user-defined function user_function.m I then made a GUI Gui.exe (built from Gui.m and Gui.fig) that simply creates the user_input.txt and then calls MyProc.exe I can now package my application with just MyProc.exe and Gui.exe; and all the user need do is write user_function.m I'm so happy!! Thanks Yemi
First
|
Prev
|
Pages: 1 2 Prev: error: "Reference to a cleared variable handles" Next: Changing variable name in for loop |