My experiment contains my subjects data and each subject consists of different blocks before I do the analysis I merged my data into one mat file, but some of my subjects have missing blocks, so I bypassed those data and merge the file. However the problem is missing blocks represent like this [ ], since some blocks are like this [ ], when I want to load different field of my structure I get this error '' Dot indexing is not supported for variables of this type '' Therefore I need to bypass these blocks in the loop, In this regard I added this code
if isempty(all_Subjects(block_Counter, subject_Counter).all_results) == 0 % do the workk
else break end
but I got empty results for saving my data in table
% merging Information of different Subjects
Subjects_ID = [];Blocks_ID = [];reactionTime_of_all_Subjects = [];performance_of_all_Subjects = [];for subject_Counter = s_Initial:s_Final % select data with fields
if isempty(all_Subjects(block_Counter, subject_Counter).all_results) == 0 % merging Information of different blocks
all_reactionTime_of_one_Subject = []; all_subject_Performance_of_one_Subject = []; for block_Counter = B_Initial:B_Final reactionTime = all_Subjects(block_Counter, subject_Counter).all_results.reactionTime; subject_Performance = all_Subjects(block_Counter, subject_Counter).all_results.performance; % merging Information of different blocks all_reactionTime_of_one_Subject = [all_reactionTime_of_one_Subject; reactionTime]; all_subject_Performance_of_one_Subject = [all_subject_Performance_of_one_Subject; subject_Performance]; % Generate label for Subjects
for i = 1: length(reactionTime) Subjects_ID = [Subjects_ID; subject_Counter] Blocks_ID = [Blocks_ID; block_Counter] end end % merging Information of different Subjects performance_of_all_Subjects = [performance_of_all_Subjects; all_subject_Performance_of_one_Subject]; reactionTime_of_all_Subjects = [reactionTime_of_all_Subjects; all_reactionTime_of_one_Subject]; else breakend end% Mering all data to table
analysis = array2table([Subjects_ID, Blocks_ID, reactionTime_of_all_Subjects, performance_of_all_Subjects]);analysis.Properties.VariableNames{1} = 'Subjects_ID';analysis.Properties.VariableNames{2} = 'Block_ID';analysis.Properties.VariableNames{3} = 'ReactionTime';analysis.Properties.VariableNames{4} = 'Performance';save('data_for_Analysis','analysis')
Best Answer