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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -