Writing a script to compile using mcc

조회 수: 17 (최근 30일)
Daniel Wells
Daniel Wells 2012년 9월 11일
I am having trouble figuring out how to automate part of my MATLAB workflow, and would appreciate some help. I am using the mcc command to compile programs on a remote machine in order to run batch jobs. However, due to a quirk in the machine setup or in the MATLAB version installed, I am required to add a single line the "run_" file outputted from mcc in order to make the code run. Furthermore, both the "run_" file and the actual compiled code must be copied to all the nodes of the remote machine via the terminal command "acp (program) (folder)"
So:
I would like to write a script which can automate this process, that is, a script which can take in the name of the file I wish to compile, compile it using "mcc -mv file", change the desired line in the outputted "run_" file, and then use "!acp file folder" to perform the acp command. I can do the last part, but the first two parts are giving me trouble. Any help in this matter would be really great.
Thanks
  댓글 수: 1
Dr. Seis
Dr. Seis 2012년 9월 12일
- Is the single line you need to add after the "run_SOMETHING.sh" related to a path needed for locating dynamically linked libraries?
- Is the location of the files that are produced from running mcc not accessible on all the other nodes that will run the program?
I've got several GUI's that I have compiled on one remote machine, but all of them can be run on any other remote machine by supplying the full path to the "run_SOMETHING.sh" followed by the full path to the directory the installation of Matlab can be found, i.e.:
/my/full/path/run_SOMETHING.sh /abc/local/some/thing/matlab/r2011a/

댓글을 달려면 로그인하십시오.

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 9월 12일
It looks like you already know how to call "mcc" and your system utility "acp" from a MATLAB script - your question as far as I can tell is just about replacing a particular string in a file with another string. You might be able to use a combination of the Low-Level File I/O functions to achieve this, but there seem to be several utilities out there to do this from MATLAB already. For example, see this MATLAB File Exchange submission: http://www.mathworks.com/matlabcentral/fileexchange/18909-replace-strings-in-text-file

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by