Using unix within MATLAB
4 次查看(过去 30 天)
显示 更早的评论
I know there are several questions similar to this one, but none seem to be applicable in my scenario.
I want to convert a pdf (or eps) file from my matlab code into a png, using the downloadable software called ImageMagick.
In my command terminal, in order to execute this file format switch, I must type
convert file_name.pdf new_file_name_with_new_format.png
then, if I wanted to display it, (which I do), I go
display new_file_name_with_new_format.png
This works fine in the terminal window, but how can I do this in matlab? What specific syntax should I use.
I've tried some stuff with !, but to no solution.
Thanks,
Gauss.
0 个评论
回答(1 个)
Walter Roberson
2016-7-6
oldname = 'file_name.pdf';
newname = 'new_file_name_with_new_format.png'
command = sprintf('convert ''%s'' ''%s''', oldname, newname);
system(command);
command = sprintf('display ''%s''', newname);
system(command)
2 个评论
Walter Roberson
2016-7-6
command = sprintf('/opt/local/bin/convert ''%s'' ''%s''', oldname, newname);
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!