Transpose matrix and your transposition
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
AIRTON
am 20 Sep. 2025
Bearbeitet: David Goodmanson
am 21 Sep. 2025
How can I transpose Thais Matrix: Matrix = zeros(3500000,3);
0 Kommentare
Akzeptierte Antwort
David Goodmanson
am 20 Sep. 2025
Bearbeitet: David Goodmanson
am 21 Sep. 2025
HI Airto,
Rather than actually transpose it with the ' (apostrophe) command, you can use
zeros(3,3500000);
The transpose
a = zeros(3.5e6,3);
b = a';
is reasonably fast, (about 17 millisec on my PC). You get up around a = zeros(3.5e8,3), though, then b = a'; takes about 1.5 sec, whereas
b = zeros(3,3.5e8)
is sub-millisec because no actual transpose is being done.
1 Kommentar
Walter Roberson
am 20 Sep. 2025
My tests show that
b = a.';
seems to be a hair faster.
a' and a.' produce identical results for real-valued data, but different results for complex-valued data.
Weitere Antworten (2)
AIRTON
am 20 Sep. 2025
Bearbeitet: Walter Roberson
am 20 Sep. 2025
3 Kommentare
David Goodmanson
am 21 Sep. 2025
Hi Chun, what you did aided the OP, but there is something going on with the 6GB estimate. A number in double precision has 64 bits, 8 bytes. So the a or b matrix runs to 3.5e6*3*8 = 84MB and should not be leagues larger with different software or platform.
Siehe auch
Kategorien
Mehr zu Function Creation 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!