function out=handLinModBS(data) resamps=10000; out=zeros(resamps,4); anat=[2 2 1;0 2 1;2 1 0;1 2 2; 2 2 2; 2 2 2]; for i=1:resamps; disp(i); dataTemp=cell(size(data)); madTemp=zeros(6,2); for j=1:6 for k=1:2 temp=data{j,k}; temp=cell2mat(temp(:,9)); which=ceil(rand(length(temp),1)*length(temp)); dataTemp(j,k)={temp(which)}; madTemp(j,k)=mad(temp(which),1); end end DMMs=(madTemp(:,2)-madTemp(:,1))./madTemp(:,1); whichLines=ceil(rand(6,1)*6); DMMsUse=DMMs(whichLines); anatUse=anat(whichLines,:); [b,bint,r,rint,stats]=regress(DMMsUse,anatUse); out(i,:)=[b' stats(1)]; end