How to write loop in MATLAB?

1 view (last 30 days)
Shuting LI
Shuting LI on 12 Nov 2020
Commented: Walter Roberson on 26 Nov 2020
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename','M04_AD1.set','filepath','C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, 'M04_AD1d' );
EEG = eeg_checkset( EEG );
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename','M05_AD1.set','filepath','C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, 'M05_AD1d' );
EEG = eeg_checkset( EEG );
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename','M07_AD1.set','filepath','C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, 'M07_AD1d' );
EEG = eeg_checkset( EEG );
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename','M08_AD1.set','filepath','C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, 'M08_AD1d' );
EEG = eeg_checkset( EEG );
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename','M10_AD1.set','filepath','C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, 'M10_AD1d' );
EEG = eeg_checkset( EEG );
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename','M12_AD1.set','filepath','C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, 'M12_AD1d' );
EEG = eeg_checkset( EEG );

Accepted Answer

Walter Roberson
Walter Roberson on 12 Nov 2020
set_numbers = [4, 5, 7, 8, 10, 12];
for K = set_numbers
setname_in = sprintf('M%02d_AD1.set', K);
setname_out = sprintf('M%02d_AD1d', K);
EEG.etc.eeglabvers = '2020.0'; % this tracks which version of EEGLAB is being used, you may ignore it
EEG = pop_loadset('filename', setname, 'filepath', 'C:\\EEG_OVGU\\AD1\\');
EEG = eeg_checkset( EEG );
EEG = pop_resample( EEG, 250);
EEG = pop_saveset( EEG, setname_out );
EEG = eeg_checkset( EEG );
end
  10 Comments
Shuting LI
Shuting LI on 13 Nov 2020
Thank you so much for your help!!!!!!
I set a breakpoint, but MATLAB isn't stopping at the breakpoint.
In addition, I don't see the Step button in the editor.

Sign in to comment.

More Answers (0)

Categories

Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!