Execution time of print command is very long?
1 次查看(过去 30 天)
显示 更早的评论
I import data with uigetfile and then plots that data, then I save the plot to jpg file to a particular folder using print command. Sample is given below. As can be seen in summary report attached it takes about 10 seconds for just 2 graphs. This is very large time spent please suggest some tweak.
print(rawfig,strcat(name,'_raw.jpg'),'-djpeg','-r600')
Also This commands overwrites the file if it exist at that location, How do I prevent it from overwriting and either asking for action or appending some digits in file name.
2 个评论
Daniel Armyr
2016-3-8
"This commands overwrites the file if it exist at that location, How do I prevent it from overwriting and either asking for action or appending some digits in file name."
Use dir() to list the files in the current folder. Check if the naem you planned to use exists in the list (ismember() can be used). If the name is used, add a number and check if that file name exists. Repeat until you find a free file name.
OK, not the most efficient, but simple.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!