An error is generated when a cluster is the size of the whole tract for one of the permutation ii. This is because in this case clusEnd = find(pThresh(ii,:) == 0) and thus clusSiz = diff(clusEnd) are empty and therefore max(clusSiz) generates an error.
A possible correction is to set the maximum cluster size to the size of the tract in such a case:
clusMax(ii) = size(pThresh(ii,:),2)
An error is generated when a cluster is the size of the whole tract for one of the permutation
ii
. This is because in this caseclusEnd = find(pThresh(ii,:) == 0)
and thusclusSiz = diff(clusEnd)
are empty and thereforemax(clusSiz)
generates an error.A possible correction is to set the maximum cluster size to the size of the tract in such a case:
clusMax(ii) = size(pThresh(ii,:),2)