Hi there! This is the code I have:
aa=rand(2,2,2); aa(1,1,1)=4; aa(2,1,1)=3; aa(1,2,1)=6; aa(2,2,1)=2; aa(1,1,2)=7; aa(2,1,2)=7; aa(1,2,2)=5; aa(2,2,2)=4; aa; dimention_aa=size(aa);
aareshaped=reshape(aa,[2,4]);
ii=rand(4,1); ii(1,1)=3; ii(2,1)=4; ii(3,1)=5; ii(4,1)=5;
for(j=(ii(1):ii(end)))
ind_reshaped=find(aareshaped==j);
irv=zeros(1,size(ind_reshaped));
irv(1,:)=ind_reshaped
[R1, C1, S1]=ind2sub(dimention_aa,ind_reshaped)
roi_mat=zeros(dimention_aa);
roi_mat(R1,C1,S1)=1
end
I want to store each [R1,C1,S1](a set of positions) on a different vector, but it just overwrites each set. What am I doing wrong?