My experiment contains my subjects data and each subject consists of different blocks, before I do the analysis I need to merge my data into one mat file, so first I need to load all of the data, but the problem is some of my subjects have missing blocks and when my codes want to read all data, It crashes and said ''Unable to read file 'Subject 1 Block 3.mat'. No such file or directory'' , so I need to bypass the data that their directory doesn't exist, so I wrote this if statement inside my code but it didn't work:
s_Initial = 1;
s_Final = 100;
B_Initial = 1;
B_Final = 3;
Subjects_ID = ;
Block_ID = ;
for subject_Counter = s_Initial: s_Final
for block_Counter = B_Initial: B_Final
load_Data = fullfile(append('Subject', ' ',num2str(subject_Counter),...
' ', 'Block',' ',num2str(block_Counter),'.mat'));
if class(load_Data) == 'char'
all_Subjects(block_Counter, subject_Counter) = load(load_Data);
Subjects_ID = [Subjects_ID; subject_Counter];
Block_ID = [Block_ID; block_Counter];