Skip to content

Commit

Permalink
#1689 xASL_stat_PrintStats: bugfixes empty end of list
Browse files Browse the repository at this point in the history
  • Loading branch information
HenkMutsaerts committed Apr 26, 2024
1 parent e2b0360 commit 7e2ad13
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Functions/Statistics/xASL_stat_PrintStats.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@
x.modules.population.(thisFile){iSubjectSession+2,1} = x.S.SubjectSessionID{iSubjectSession, 1}; % I'm not 100% sure this is correct, how do I test this?

%% Print the covariates and data
iSubjectSession_SetsID = iSubjectSession;
iSubjectSession_DAT = iSubjectSession;
bPrintSessions = true;
x.modules.population.(thisFile) = xASL_stat_PrintStats_FillStatCellArray(x,x.modules.population.(thisFile),iSubjectSession,iSubjectSession_SetsID, iSubjectSession_DAT, bPrintSessions);
x.modules.population.(thisFile) = xASL_stat_PrintStats_FillStatCellArray(x, x.modules.population.(thisFile), iSubjectSession, bPrintSessions);

end
end
Expand Down Expand Up @@ -204,11 +202,10 @@

%% Print the covariates and data
iSubjectSession_SetsID = x.dataset.nSessions*(SubjectIndex-1)+SessionN;
iSubjectSession_DAT = iSubjSess;
bPrintSessions = false;

% Write it to the cell array instead
x.modules.population.(thisFile) = xASL_stat_PrintStats_FillStatCellArray(x,x.modules.population.(thisFile),iSubjSess,iSubjectSession_SetsID, iSubjectSession_DAT, bPrintSessions);
x.modules.population.(thisFile) = xASL_stat_PrintStats_FillStatCellArray(x, x.modules.population.(thisFile), iSubjSess, bPrintSessions);
end
end
end
Expand Down Expand Up @@ -347,10 +344,10 @@
end

%% Fill the stat cell array with all subjects and sessions xASL_tsvWrite later on
function statCell = xASL_stat_PrintStats_FillStatCellArray(x,statCell, rowNum, iSubjectSession_SetsID, iSubjectSession_DAT, bPrintSessions)
function statCell = xASL_stat_PrintStats_FillStatCellArray(x, statCell, iSubjectSession_DAT, bPrintSessions)

% Skip the first two rows and columns (Labels & Legend, Subjects & Sessions)
rowNum = rowNum+2;
rowNum = iSubjectSession_DAT + 2;
iCell = 3;

% 1. print values for other covariates
Expand Down Expand Up @@ -387,7 +384,11 @@
% 2. Print data in x.S.DAT
% This part is different for volume or TT, since there will be only 1 value per subject (this will be done by the above in which nSessions is set to 1
for iPrint=1:size(x.S.DAT,2) % print actual data
statCell{rowNum,iCell} = xASL_num2str(x.S.DAT(iSubjectSession_DAT, iPrint));
if size(x.S.DAT, 1)<iSubjectSession_DAT
statCell{rowNum, iCell} = 'n/a';
else
statCell{rowNum, iCell} = xASL_num2str(x.S.DAT(iSubjectSession_DAT, iPrint));
end
iCell = iCell+1;
end

Expand Down

0 comments on commit 7e2ad13

Please sign in to comment.