methlabUZH / automagic

Automagic
GNU General Public License v3.0
89 stars 32 forks source link

Error in Project/checkExistings if nProcessedFiles > 0 (without GUI) #57

Open morryis opened 2 years ago

morryis commented 2 years ago

I am using automagic without GUI. When calling preprocessAll() I get an error whenever nProcessedFiles > 0: `>> project.preprocessAll(); Index exceeds the number of array elements (0).

Error in Project/checkExistings (line 1654) [main_pos(3)/2/screen_size(3) main_pos(4)/2/screen_size(4)], ...

Error in Project/preprocessAll (line 441) skip = self.checkExistings();` The variable "main_pos" is empty when running the scripts without GUI. Possible solution could be to add an additional parameter e.g. skip_existing = true/false

ksgfan commented 2 years ago

Hi, thanks for catching that!

For now, we will only check whether the main_pos is empty. If yes, there will be no option of skipping the files, but the preprocessed files will be skip per default.

if ~isempty(main_pos)
        screen_size = get( groot, 'Screensize' );
        choice = MFquestdlg(...
            [main_pos(3)/2/screen_size(3) main_pos(4)/2/screen_size(4)], ...
            ['Some files are already processed. Would ',...
            'you like to overwrite them or skip them ?'], ...
            'Pre-existing files in the project folder.',...
            'Over Write', 'Skip','Over Write');
        switch choice
            case 'Over Write'
                skip = 0;
            case 'Skip'
                skip = 1;
        end
end