- Are the requested number of elements the same?
- Are the requested dimension values all non-negative integers?
- If there is a missing dimension, calculate this value and make sure it is an integer.
- Can the result be a shared data copy? (e.g., for a full matrix)
- Will the result need to be a deep data copy? (e.g., for a sparse matrix)
- Etc.
View Reshape Function Code
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Aidan Shek
am 1 Jun. 2020
Kommentiert: Steven Lord
am 23 Sep. 2020
I would like to open and view the code for the reshape function, does anyone have a copy?
0 Kommentare
Akzeptierte Antwort
James Tursa
am 1 Jun. 2020
All it basically does is replace the dimensions with the requested dimensions in the internal variable header. There wouldn't be much to see even if you could see the source code for that part. Most of the code is probably for the checking, e.g.,
2 Kommentare
isamh
am 23 Sep. 2020
what if I use reshape with negative decimal values? the output shows all the values but shows all negative values as positive.
Weitere Antworten (1)
Steven Lord
am 1 Jun. 2020
We don't distribute the source code for that built-in function.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!