creat matrix with specific row element

28 visualizaciones (últimos 30 días)
Mohannad Almalki
Mohannad Almalki el 16 de Oct. de 2020
Respondida: KSSV el 16 de Oct. de 2020
Create a matrix of 100 rows and 100 columns. The odd columns should contain values 2, and the even columns, values 0

Respuestas (1)

KSSV
KSSV el 16 de Oct. de 2020
iwant = zeros(100) ;
iwant(:,1:2:end) = 2 ;

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by