Prev: Please Help with My Fixed Point Iteration Program
Next: Redundancy & significance of canonical correlation results
From: Nicolas on 18 Apr 2010 14:23 I've searched through the newsgroup archives for an answer to my question, and I've read through FAQ 4.12, but I still can't find a solution to my particular issue. I'm trying to automate the saving of a figure as .fig. It is in a loop which changes the figure's filename with each iteration of the loop. Here's the relevant portion of code: figname = sprintf('%s_%s_%s\b\b\b\b', EEG.chanlocs(currChan1).labels, EEG.chanlocs(currChan2).labels, currfile); figname = Fz_Cz_STROOP0037 figure; saveas(gcf, figname, 'fig'); ------ Everything works beautifully until the saving. Thanks, Nick
From: ImageAnalyst on 18 Apr 2010 16:16 What's the problem? Didn't it add the .fig extension? Try putting .fig into the end of your format string in your printf(). And what's the point of the 4 \b's?
From: Nicolas on 18 Apr 2010 20:07 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <7b25bb23-61c2-46d3-9d26-e99b8bd23d61(a)c1g2000vbc.googlegroups.com>... > What's the problem? Didn't it add the .fig extension? Try > putting .fig into the end of your format string in your printf(). And > what's the point of the 4 \b's? I put the \b's in there because I only needed a portion of the string (it is used in its full form in other functions of the script). I tried your idea, but it gave me a similar response as my original: ??? Error using ==> save Unable to write file Fz_Cz_STROOP0037.fig: Invalid argument. Error in ==> hgsave at 239 save(filename, 'hgS_070000',varargin{save_args:end}); Error in ==> general\private\saveasfig at 7 hgsave( h, name ); Error in ==> saveas at 130 feval( ['saveas' format], h, name ) Error in ==> coherence at 59 saveas(gcf, figname); ---------------- Your thoughts? Thanks, Nick
From: ImageAnalyst on 18 Apr 2010 20:37 Nick: Does it work if you hard code the name Fz_Cz_STROOP0037.fig in there? Maybe that weird \b stuff is messing it up - you don't see it but it's there as hidden characters. Why don't you just use regular indexing like currfile(1:end-4) to get all but the last 4 chars, instead of the full currfile and 4 backspaces (which is kind of weird - I've not seen that before)?
From: Nicolas on 18 Apr 2010 20:55
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <280e5ef9-235d-4640-89ca-0b2f01572fd8(a)i12g2000vba.googlegroups.com>... > Nick: > Does it work if you hard code the name Fz_Cz_STROOP0037.fig in there? > Maybe that weird \b stuff is messing it up - you don't see it but it's > there as hidden characters. Why don't you just use regular indexing > like currfile(1:end-4) to get all but the last 4 chars, instead of the > full currfile and 4 backspaces (which is kind of weird - I've not seen > that before)? Ah ha! Worked wonderfully. Thanks for the tip. It must have been the \b's messing it up. |