- The rsim.tlc is meant for rapid prototyping on a machine where MATLAB/Simulink is installed, and therefore does not generate completely standalone code. If you'd like to run the code on a machine without access to Simulink, you probably want to use grt.tlc that comes with the Simulink Coder product.
- You are generating code on a Windows machine with produces a Windows-specific binary (the .exe extension denotes a Windows executable). If you have access to Simulink on a Linux machine, that would be the easiest way to obtain a Linux executable instead. If that is not possible, please read this blog post to see how you can relocate the generated code to another machine to compile. Note that you will need to figure out the right build commands to use, since on a Windows machine, Simulink Coder will generate a Makefile meant for Windows.
How can I compile an executable in Simulink on Windows to run from Matlab on Linux or from a Linux command line?
24 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have created a Simulink model with MATLAB version R2012a on Windows 7, and want to run it on my University's advanced computing cluster. However, the cluster runs on a Linux based OS (Red Hat) and does not have a Simulink license. So, I used the code generation package in Simulink to create and executable file that I can run using MATLAB. However, I cannot get the executable to run through the Linux MATLAB on the cluster. I receive the error "/bin/bash: ./HLE.exe: cannot execute binary file".
I will explain the small bit of troubleshooting I have done already, in case I have screwed something up.
When I run the executable on my Windows machine, the file executes correctly. However, when I transfer the files to the cluster and run from the Linux version of MATLAB (also 2012a), I receive some errors.
In Windows MATLAB my command is
>> !HLE.exe -i input.mat
If I try to use the same command as above in Linux MATLAB, I receive the error "/bash/bin: HLE.exe: command not found". This is apparently a problem with the path, and can be fixed using the command
>> !./HLE.exe -i input.mat
However, I received a permission error. To resolve this I changed the permissions of the file by using "chmod 755 HLE.exe" from the Linux command line.
Running the same command again from Linux MATLAB on the cluster, I receive a new and different error.
>> !./HLE.exe -i input.mat
/bash/bin: ./HLE.exe: cannot execute binary.
Here is where I am stuck. This says to me that the exe simply won't work using the MATLAB version on Linux. How can I work around this?
Can I somehow compile differently, perhaps choose a different code generation target, to make an executable that works with the Linux MATLAB? Or perhaps I can compile to run the executable stand alone on the Linux command line? Or can I somehow compile the C code and make file generated by Simulink with Linux to run stand alone?
Thanks!
-Kevin
A little more info! I am using the rsim.tlc system target file to generate C code from using the Simulink code generation packages.
0 件のコメント
回答 (1 件)
Kaustubha Govind
2013 年 4 月 12 日
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!