creat matrix with specific row element

26 次查看(过去 30 天)
Create a matrix of 100 rows and 100 columns. The odd columns should contain values 2, and the even columns, values 0

回答(1 个)

KSSV
KSSV 2020-10-16
iwant = zeros(100) ;
iwant(:,1:2:end) = 2 ;

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by