How to export data from MATLAB to machine language
Show older comments
hey i have just finished writing a code in matlab to run certain machine. how do i export the code from matlab to a language that can be read and executed by any machine?
Answers (2)
Paulo Silva
on 18 Apr 2011
deploytool %it will only work if you have the required toolboxes
11 Comments
Kaustubha Govind
on 18 Apr 2011
There is also MATLAB Coder (http://www.mathworks.com/products/matlab-coder/) if you are using the supported subset of the MATLAB language.
Judith Amulen
on 20 Apr 2011
Kaustubha Govind
on 20 Apr 2011
For deploytool, you need to get a license for MATLAB Compiler. The documentation has an example: http://www.mathworks.com/help/toolbox/compiler/bsl9c8_.html
For MATLAB Coder, there is an example here: http://www.mathworks.com/help/toolbox/coder/gs/bsumpws-1.html
Judith Amulen
on 29 Apr 2011
Kaustubha Govind
on 29 Apr 2011
Do you want to export code or data?
Walter Roberson
on 29 Apr 2011
If it is data that you are trying to export, then we need to know what data type it is in in your program, and what data type you need it to be in the target machine, and we need to know what the internal representation is for numbers on the target machine (e.g., you might be switching between Little-End integers and Big-End integers, or perhaps the target machine uses only fixed precision decimal arithmetic instead of floating point.)
We would also need to know what kind of file format the target can use to store the values. For example, in order to load the data properly is it necessary to represent it in Motorola S-Block Format, or can we just write a continuous stream of binary data because the target machine _does_ have an equivalent of fread() ?
Judith Amulen
on 2 May 2011
Kaustubha Govind
on 2 May 2011
The Laser Tracking demo is written in MATLAB using functions like videoinput, which are not supported by MATLAB Coder as far as I know. However, you might be able to re-implement the core algorithm using functions that are supported for code generation, and integrate it with your own hardware drivers.
Judith Amulen
on 3 May 2011
Kaustubha Govind
on 3 May 2011
Sorry. Can't think of anything else other than re-implementing. :(
Jiro Doke
on 3 May 2011
The original answer by Paulo is probably the best choice here. Either use "deploytool" with MATLAB Compiler product or re-implement everything yourself in another language.
Walter Roberson
on 18 Apr 2011
0 votes
The closest you can get to what you actually asked would be to convert the program to a Turing Machine; then to use it on any machine, it would only be necessary to write the appropriate Universal Turing Machine shim appropriate to the Turing Machine implementation on that machine.
Unfortunately, embedded systems often have enough resource restrictions that they would not reasonably be classified as Turing Complete. You are very unlikely to be able to fit your image processing program in to your toaster, for example, and if you did then the "input" to the toaster would probably have to be encoded in moisture levels of the pieces of bread.
Possibly you might be able to get the program to fit on your Digital Watch With The Special Snooze Alarm, but it might be hard to find one of those that still works.
6 Comments
Judith Amulen
on 20 Apr 2011
Walter Roberson
on 20 Apr 2011
I don't know what hardware exactly would be in a Motion Table, but it seems most likely that you would be wanting MATLAB Coder as referenced by Kaustubha -- if the hardware is a suitable candidate.
Judith Amulen
on 3 May 2011
Jiro Doke
on 3 May 2011
What exactly is controlling the motion table? Is there a software that does it? Does it have some C API that could be used to control it? Does it have a data acquisition board that could send voltages to control the table? Or something else?
Judith Amulen
on 3 May 2011
Jiro Doke
on 3 May 2011
Is that a standalone compiled application? Or do you actually have the C# source code that you can modify and integrate your MATLAB application? If it's a standalone, does it provide some kind of API that you can call from outside to send command to the motion table? If it provides some shared library, then you can incorporate that into your MATLAB program (using "loadlibrary") and then compile your application using MATLAB Compiler.
Categories
Find more on Data Acquisition Toolbox Supported Hardware 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!