Skip to content

Commit 6214f00

Browse files
authored
Merge pull request #559 from Remi-Gau/not_batch_mat
[ENH] only save batches as .m files
2 parents b27827b + c5884c3 commit 6214f00

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/batches/saveMatlabBatch.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function saveMatlabBatch(matlabbatch, batchType, opt, subLabel) %#ok<INUSL>
22
%
3-
% Saves the matlabbatch job in a .mat and a .m file.
3+
% Saves the matlabbatch job in a .m file.
44
% Environment information are saved in a .json file.
55
%
66
% % USAGE::
@@ -9,14 +9,17 @@ function saveMatlabBatch(matlabbatch, batchType, opt, subLabel) %#ok<INUSL>
99
%
1010
% :param matlabbatch:
1111
% :type matlabbatch: structure
12+
%
1213
% :param batchType:
1314
% :type batchType: string
15+
%
1416
% :param opt: Options chosen for the analysis. See ``checkOptions()``.
1517
% :type opt: structure
18+
%
1619
% :param subLabel:
1720
% :type subLabel: string
1821
%
19-
% The .mat file can directly be loaded with the SPM batch or run directly
22+
% The .m file can directly be loaded with the SPM batch or run directly
2023
% by SPM standalone or SPM docker.
2124
%
2225
% The .json file also contains heaps of info about the "environment" used
@@ -52,6 +55,8 @@ function saveMatlabBatch(matlabbatch, batchType, opt, subLabel) %#ok<INUSL>
5255

5356
saveSpmScript(batchFileName);
5457

58+
delete(batchFileName);
59+
5560
[OS, GeneratedBy] = getEnvInfo(opt);
5661
GeneratedBy(1).Description = batchType;
5762

tests/tests_batches/test_saveMatlabBatch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function test_saveMatlabBatch_basic()
2121
expectedOutput = fullfile(pwd, ['sub-' subLabel], ...
2222
['batch_test_' datestr(now, 'yyyy-mm-ddTHH-MM') '.mat']);
2323

24-
assertEqual(exist(expectedOutput, 'file'), 2);
24+
assertEqual(exist(expectedOutput, 'file'), 0);
2525
assertEqual(exist(spm_file(expectedOutput, 'ext', '.json'), 'file'), 2);
2626

2727
expectedOutput = fullfile(pwd, ['sub-' subLabel], ...
@@ -47,7 +47,7 @@ function test_saveMatlabBatch_group()
4747

4848
saveMatlabBatch(matlabbatch, 'groupTest', opt);
4949

50-
assertEqual(exist(expectedOutput, 'file'), 2);
50+
assertEqual(exist(expectedOutput, 'file'), 0);
5151
assertEqual(exist(spm_file(strrep(expectedOutput, '-', '_'), 'ext', '.m'), 'file'), 2);
5252

5353
cleanUp(fullfile(pwd, 'group'));

0 commit comments

Comments
 (0)