HI HOW TO GENERATE A DOT MATRIX WITH ONES AND ZEROS?

4 views (last 30 days)
HI I HAD GENERATE A MATRIX OF ONES(8)
MY QUESTION IS I WANT TO MAKE ALL THE EVEN ROWS OF THAT MATRIX TO ZERO...
HOW CAN I DO THAT PROCESS
CAN ANYONE HELP ME.

Answers (1)

Roger
Roger on 18 Mar 2014
Edited: Roger on 18 Mar 2014
A=ones(8);
for i=1:4
A(2*i,:)=zeros(1,8);
end
or A(2:2:8,:)=zeros(1,8);

Categories

Find more on Resizing and Reshaping Matrices 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!