every other matching element in matrix MATLAB -


i have matrix of 2 values, example:

[ 1  1  1  1  1  0  0  0  1  1  0  0  0    0  0  0  0  1  1  1  1  0  0  0  1  1 ] 

i want to change every other element in row "1" 0, output be:

[ 0  1  0  1  0  0  0  0  1  0  0  0  0   0  0  0  0  1  0  1  0  0  0  0  1  0 ] 

if matrix m can do:

ind=find(m(:)==1); m(ind(1:2:end))=0; 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -