creat matrix with specific row element

조회 수: 28 (최근 30일)
Mohannad Almalki
Mohannad Almalki 2020년 10월 16일
답변: KSSV 2020년 10월 16일
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