Adding zeros in the empty places in a matrix.

3 vues (au cours des 30 derniers jours)
S Priya
S Priya le 12 Nov 2021
Réponse apportée : KSSV le 12 Nov 2021
A is a 252x1 matrix, and I have values of 1st 13th 25 th 73th 121th 109th 97th 61th row. and have to fill the remaining spaces with zeros. Please help me with it.

Réponse acceptée

KSSV
KSSV le 12 Nov 2021
A = rand(252,1) ;
iwant = zeros(252,1) ;
idx = [1 13 25 73 121 109 97 61] ;
iwant(idx) = A(idx) ;

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by