Populate a column vector with values from another column vector
Mostra commenti meno recenti
Hey!
I have a column vector A that is 1x50 that contains values
I want to populate a 1x57 zero column vector B with the values of A at a certain index.
E.g. At index 0,1,2,5,7,8,11 should all be 0 - the other values of vector B should be populated from the non-zero values in vector A. How do i go about doing this?
2 Commenti
KSSV
il 5 Dic 2022
How index can be 0? Index cannot be zero. Your question is not clear though.
Raahim Muzaffar
il 5 Dic 2022
Risposta accettata
Più risposte (1)
Voss
il 5 Dic 2022
B = zeros(57,1); % 57x1 column vector
B([4 5 7 10 11 13:end]) = A;
Categorie
Scopri di più su Resizing and Reshaping Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!