Whats the difference between the two statements
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Difference between
(reshape(key,2,[])')
and
reshape(key,2,[])
0 Kommentare
Antworten (2)
Cris LaPierre
am 13 Dez. 2020
"Specify [] for the first dimension to let reshape automatically calculate the appropriate number of rows."
If you specify [] in the second dimention, it will automatically determine the appropriate number of columns for the specified number of rows.
1 Kommentar
Cris LaPierre
am 13 Dez. 2020
Ah, missed the transpose (the apostrophe) after the first one. That transposes the results of reshape. It's probably just easiest to test it and see:
key = magic(4);
reshape(key,2,[])'
reshape(key,2,[])
Another way is to just swap the 2 and the [].
reshape(key,[],2)
Bruno Luong
am 13 Dez. 2020
The second creates 2-row matrix.
The first creates 2-column matrix, since it make a transpose after reshape.
1 Kommentar
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!