How can I set column of matrix divisible by 12
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Farshid Daryabor
il 10 Mar 2020
Commentato: Farshid Daryabor
il 10 Mar 2020
I have a matrix 'M(1715*3849)' I want to reshape it to a Matrix that the size of the column can divisible with 12. How can I do it?
Thanks in advance.
>> 3849/12
ans =
320.7500
2 Commenti
Turlough Hughes
il 10 Mar 2020
Why do you want to do that, can you provide some context? There is no way to do it without removing values or adding empty values.
Risposta accettata
Ameer Hamza
il 10 Mar 2020
Modificato: Ameer Hamza
il 10 Mar 2020
It will append columns with nan value
M = rand(1715, 3849);
extra_columns = ceil(size(M,2)/12)*12 - size(M,2);
M = padarray(M, [0, extra_columns], nan, 'post');
size(M,2)/12
Result:
ans =
321
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical 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!