Monday 15 March 2010

save figure on multiple folders on matlab -


I am new to matlab and at this time I do not know many things.

I have a script that produces more than 100 figures, I want to save those data in 3 separate folders. So far my code is:

  pridir = 'C: \ users \ tasos \ desktop \ folder'; Figtxt1 = 'folder1'; Figtxt2 = 'folder2'; Figtxt3 = 'folder3'; YM = Load ('Pathomada'); [N, m] = size (YM); Maxtau 2 = 10; Alpha = 0.05; Jamalfa = normal (+ 1 / alpha / 2); P = 6; For I = 1: J = I + 1: for M-1: M shape () y1V = ym (:, i); Y2V = YM (:, j); Plot (y1V, 'b') plot (y2V, 'r') legend (sprintf ('text =% d', 'i'), sprintoff ('text =% d', j)) ('my title') Printto = Sprintf ('% s% d \\ text% d and% d.jpg', Pradir, I, I, J); Close the print ('-djpeg90', printto) and end (gcf) and end   

If I leave my code this way, then all the data has been prepared but saved on folders No. If I remove "%" from the previous two rows, then I have the following error

  Error in using the name (line 103) Output file 'C: \ users \ tasos \ Desktop \ Folder1 can not create \ Text1 and 2.jpg 'error in print (line 206) pj = name (pj); Error in testing (line 25) print ('-djpeg90', printto)   

PS I R2012b version

eval () !

Define a typical print directory:

  pridir = 'C: \ Users \ *** \ desktop \ fold';   

Then inside the inner loop:

  printto = sprintf ('% s% d') figure text% d and% d.jpg ', the printer , I, i, j); Print ('- djpeg90', printto)   

Where printto will be something like this:

  C: \ user \ * * * \ Desktop \ fold1 \ figuretext 1 and 3.jpg   

In addition, you may want to close this figure after the print: close (gcf) .

Note: In the directories where you are about to save the files, already exist, otherwise they should send mkdir () Make it

No comments:

Post a Comment