For matrix A shown. I want that after reaching maximum value of 32 the next entries should change to max value+some interval. e.g. instead of 31 it should be 32+1 and so on. Can I do that? Pls guide 🙂
A=[21 23 25 27 28 32 31 29 26];
I have tried this but it doesn't work
A2=zeros(size(A)); for kk=1:length(A) if A(kk)<max(A(kk)); A2(kk)=max(A(kk))+1; else A2(kk)=A(kk); end end disp (A2)
Best Answer