Hi All,
The problem Xiang describes arises because all the figures are saved to
the same working directory (eg C:/My Documents/MATLAB/ ). Each figure
is saved with only the month and day in the filename (eg
spm_2008Nov19.ps), so there can only be one unique file per day. An
easy fix is to just change spm_print so that the filename will include
the current time as well. As long as there isn't more than one figure
generated per second (in which case I envy you!), this should be safe.
To do this, in spm_print, change
t = clock;
nam = ['spm_' num2str(t(1)) mon{t(2)} sprintf('%.2d',t(3))];
to
t = fix(clock);
nam = ['spm_' num2str(t(1)) mon{t(2)} sprintf('%.2d',t(3)) '_'
sprintf('%.2d',t(4)) sprintf('%.2d',t(5)) sprintf('%.2d',t(6))];
Hope this helps,
Neil
Marko Wilke wrote:
> Hi Xiang,
>
>> spm5, when analyze multiple subjects using the Tasks->batch, the realign
>> figure (showing the head motion) of previous subjects will be
>> overwrited by
>> the realign figure of the next subjects.
>> So, how to customize the place and the name of the realign figure to
>> avoid
>> the situation? Thanks
>
> The figure as displayed by spm is only a representation of the
> information stored in the realignment parameters text file, so you can
> re-create the figure by reading in those parameters, for example using
> this bit of code:
> % =================================
> filt = ['^rp_*','.*\.txt$'];
> files = spm_select([1 Inf],filt,'Select parameters',[],pwd,'.*');
> mydata = spm_select(1,'dir','Select data directory',[],pwd);
> old_pwd = pwd;
> cd(mydata);
> res = 96;
>
> for i = 1:size(files,1)
> printfig = figure;
> [p nm e] = fileparts(deblank(files(1,:)));
> pd = strrep(p, '\', '/');
> set(printfig, 'Name', ['Motion parameters from ' pd],...
> 'Visible', 'off');
> plot(load([p filesep nm e]));
> title(['Data from ' pd], 'interpreter', 'none');
> motname = [mydata 'motion_sub_' sprintf('%02.0f', i) '_' date '.png'];
> print(printfig, '-dpng', '-noui', ['-r' num2str(res)], motname);
> close(printfig)
> end;
> cd(old_pwd)
> % =================================
>
> Enjoy,
> Marko
--
Neil R. Chatterjee
Research Assistant
Stanford Systems Neuroscience & Pain Lab
650-724-0522
[log in to unmask]
|