I want to know can i use this code for my projects?
ftp://ftp.nodc.noaa.gov/nodc/archive/arc0032/0071189/1.1/data/0-data/AT003L11/RR_MOVED/FUNFUN/ODE23.C
it uses a include mex.h file in the beginning. what is that? what is that mex header doing there? can i just ignore that line and use the rest of the code in somewhere else?
I want to use the file in android NDK.
This file is meant to be compiled for Matlab to process. If you have Matlab installed you can compile it from the console. If not you will not be able to compile this by simply removing the include statement. Your best bet is to read through the code, understand what it is doing, and use it as an example for your own code.
Related
I have just started to use MAPLE. I am a matlab user.
In matlab I can use any matlab function(.m file) written in same directory.
Could someone help me out how I can do same with MAPLE. I have few worksheets performing some tasks(all in same directory)
I need to use those functions and write my own code.
Thanks in advance
Have you looked at packages? They use the same module structure as objects, but for a different purpose - they are meant to make code reusable.
A package can be maintained as source file and then be read from the current directory by its filename: read("MyModule.mpl"). This seems similar to what you are used from matlab, except that you would have to load the module explicitly. Alternatively it can be saved as binary *.mla file (Maple library archive) somewhere on the library path, then loaded by its exported package name from anywhere: with(MyModul).
I'm using MATLAB R2015a application compiler. After choosing my main m-file, MATLAB found some files required for application to run but after compiling and running my application, the compiled application can't find some specific m-files from an installed toolbox (third-party toolbox).
Now i want copy all toolbox files to target folder C:\Users\My_Account\AppData\Local\Temp\My_Account\mcrCache8.5\Program_70\DDM. DDM is my toolbox folder that MATLAB creating it automatically based on nested files as mentioned above. I want add other files to this folder. How can I do this? and is this a good solution to fix this problem?
What you're trying to do won't work.
When you compile an application with MATLAB Compiler, it finds all code that your main function depends on, encrypts it, and packages it into an executable that will later be executed against the MATLAB Compiler Runtime (MCR).
The MCR can only execute code that has been encrypted and packaged in this way - it is not possible to get it to execute a regular unencrypted MATLAB file. So dumping things into the temp folder that the MCR uses to unpackage code files will not achieve anything.
Instead try to figure out why, during the dependency analysis, MATLAB Compiler is not finding all the files that your main function depends on.
There are various reasons why that might happen - the dependency analysis is not perfect. For example, if your code calls eval('myfunction'), the dependency analysis will not find myfunction. I answered another question recently where another cause was the issue.
In these situations you can explicitly tell MATLAB Compiler that there is a dependency on myfunction, using the %#function pragma. Within the file that contains the hidden call to myfunction, at the top of the file (actually anywhere, but typically you'd put it at the top), put
%#function myfunction
MATLAB Compiler will then force that to be a dependency and include it in the packaging.
Alternatively, when setting up the packaging with mcc or in the deploytool app, you can just manually add myfunction to the package yourself (although this will then not find things that myfunction depends on).
I m working on a Matlab project and I need UsbWebcams package for capture image from webcam. I can run .m file in matlab but when I compile project to create an exe file, My exe file return an error because usbWebcams package have some special .p files(Utility.p,webcamchannel.p etc) and I can not use these file for compiling.I searced on Internet and I didnt find any answer for this. How can I use .p files in my project. I think there should be a solution and I should find it. Thanks for helping to all.
Although MATLAB Compiler should be able to compile .p files, it's possible that the .p files you're trying to compile may have dependencies that you can't see because they're p-coded. For example, they might call an external library (this is quite possible if they are for interfacing with a webcam), or they might call another function using eval.
Whether they're .m files or .p files, if the files you're trying to compile have a dependency of this sort you need to include it explicitly for the Compiler, otherwise it won't know where to find it. But if the file is p-coded, it's tough to find out what the dependencies might be. You might need to ask MathWorks directly for support in compiling this functionality.
I have a precompiled static library propa64.a, which i want to use in Matlab in Linux.
No source code of it available, only header file (propa.h). As far as i understand, to use it in Matlab i need to create mex file. How can i do it, without source and with only compiled propa64.a?
mex propa64.a
doesn't work, matlab says "mex: no filename given" error.
Any suggestions?
Or , may be it's possible to use pre-compiled static library in Matlab somehow else?
I was wondering if there is a way to create a '.exe' file from ' .m' file in MATLAB, such that it can be run in machine which does not have MATLAB (like it can be done in C, C++).
I know writing a MATLAB function is one way, but I am not sure if it can run in machine without MATLAB.
Also I would like to hide my code and just create a script which can be run by a user using his own data files.
The Matlab Compiler is the standard way to do this. mcc is the command. The Matlab Runtime is required to run the programs; I'm not sure if it can be directly integrated with the executable or not.
If you have MATLAB Compiler installed, there's a GUI option for compiling. Try entering
deploytool
in the command line. Mathworks does a pretty good job documenting how to use it in this video tutorial: http://www.mathworks.com/products/demos/compiler/deploytool/index.html
Also, if you want to include user input such as choosing a file or directory, look into
uigetfile % or uigetdir if you need every file in a directory
for use in conjunction with
guide
Try:
mcc -m yourfile
Also see help mcc
If your code is more of a data analysis routine (vs. visualization / GUI), try GNU Octave. It's free and many of its functions are compatible with MATLAB. (Not 100% but maybe 99.5%.)
mcc -?
explains that the syntax to make *.exe (Standalone Application) with *.m is:
mcc -m <matlabFile.m>
For example:
mcc -m file.m
will create file.exe in the curent directory.
It used to be possible to compile Matlab to C with older versions of Matlab. Check out other tools that Matlab comes with.
Newest Matlab code can be exported as a Java's jar or a .Net Dll, etc. You can then write an executable against that library - it will be obfuscated by the way. The users will have to install a freely available Matlab Runtime.
Like others mentioned, mcc / mcc.exe is what you want to convert matlab code to C code.
The "StandAlone" method to compile .m file (or files) requires a set of Matlab published library (.dll) files on a target (non-Matlab) platform to allow execution of the compiler generated .exe.
Check MATLAB main site for their compiler products and their limitations.
I developed a non-matlab software for direct compilation of m-files (TMC Compiler). This is an open-source converter of m-files projects to C. The compiler produces the C code that may be linked with provided open-source run-time library to produce a stand-alone application. The library implements a set of build-in functions; the linear-algebra operations use LAPACK code. It is possible to expand the set of the build-in functions by custom implementation as described in the documentation.