Writing a script to compile using mcc
15 views (last 30 days)
Show older comments
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 Comment
Dr. Seis
on 12 Sep 2012
- 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/
Answers (1)
Kaustubha Govind
on 12 Sep 2012
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
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!