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

4 次查看(过去 30 天)
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.

回答(1 个)

Roger
Roger 2014-3-18
编辑:Roger 2014-3-18
A=ones(8);
for i=1:4
A(2*i,:)=zeros(1,8);
end
or A(2:2:8,:)=zeros(1,8);

类别

Help CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by