How to insert a columns of NaNs in between a matrix at multiple places
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Mohammed Yousuf
il 12 Giu 2020
Modificato: madhan ravi
il 12 Giu 2020
I have a matrix of 1440X4792 and I want to insert few columns (lets say 1277) of NaNs at different positions say (column positions : 1,3,6,99,100...)
Finally, my matrix will become 1440X6069 in which 1277 columns are NaN columns which we have inserted, rest of the 4792 columns remain same.
0 Commenti
Risposta accettata
madhan ravi
il 12 Giu 2020
Modificato: madhan ravi
il 12 Giu 2020
[m, n] = size(matrix);
Wanted = nan(m, n + numel(col_pos));
Wanted(:,setdiff(1:size(Wanted,2),col_pos)) = matrix
Più risposte (0)
Vedere anche
Categorie
Scopri di più su NaNs in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!