Increasing the Specific Matrix Entries by Some Interval
Show older comments
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)
Accepted Answer
More Answers (1)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!