creat matrix with specific row element

31 vues (au cours des 30 derniers jours)
Mohannad Almalki
Mohannad Almalki le 16 Oct 2020
Réponse apportée : KSSV le 16 Oct 2020
Create a matrix of 100 rows and 100 columns. The odd columns should contain values 2, and the even columns, values 0

Réponses (1)

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

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by