matlab - Increase column values by 1 which satisfy some condition -


in matlab, have 10x14 matrix.

how can increase positive numbers appear in first 6 columns , less 5, 1?

of cause, don't want use loop. expect more elegant way solve problem.

a(:,1:6) = a(:,1:6) + (a(:,1:6) < 5 & a(:,1:6) > 0) 

where matrix


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -