Execution time of print command is very long?

조회 수: 1 (최근 30일)
Samir
Samir 2016년 3월 7일
댓글: Samir 2016년 3월 9일
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
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.
Samir
Samir 2016년 3월 9일
Thank you for the comment, this is nice workaround and should work for me. But I am looking for some clean matlab implementation for this.
Also this is off topic but if any one can tell me why does the following code work for matlab 2015 but not for matlab 2012.
findpeaks(ampl(2:N1/2),f,'MinPeakDistance',1000,'MinPeakProminence',20,'Npeaks',4)

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by