Adding zeros in the empty places in a matrix.

조회 수: 2(최근 30일)
S Priya
S Priya 2021년 11월 12일
답변: KSSV 2021년 11월 12일
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.

채택된 답변

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by