Transpose matrix and your transposition

76 visualizaciones (últimos 30 días)
AIRTON
AIRTON el 20 de Sept. de 2025 a las 7:38
Editada: David Goodmanson el 21 de Sept. de 2025 a las 17:45

How can I transpose Thais Matrix: Matrix = zeros(3500000,3);

Respuesta aceptada

David Goodmanson
David Goodmanson el 20 de Sept. de 2025 a las 7:50
Editada: David Goodmanson el 21 de Sept. de 2025 a las 17:45
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 comentario
Walter Roberson
Walter Roberson el 20 de Sept. de 2025 a las 10:21
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.

Iniciar sesión para comentar.

Más respuestas (2)

AIRTON
AIRTON el 20 de Sept. de 2025 a las 13:51
Editada: Walter Roberson el 20 de Sept. de 2025 a las 19:24
Hi David and Hi Walter
I thank by yours attention. But when I carry out this:
a = zeros(3.5e6,3);
b = a';
or this
b = a.';
I get this:
Cannot display summaries of variables with more than 524288 elements.
How can I resolve this, please
Thank!
  3 comentarios
AIRTON
AIRTON el 20 de Sept. de 2025 a las 18:06
Hy Chun
great, very good!
I have got to access the data.
Thank you very much!
David Goodmanson
David Goodmanson el 21 de Sept. de 2025 a las 4:05
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.

Iniciar sesión para comentar.


AIRTON
AIRTON el 20 de Sept. de 2025 a las 19:27
Editada: Walter Roberson el 20 de Sept. de 2025 a las 21:10
Hi David, Walter and Chun
I am here again!
With yours helps I have done this scritp to filter two columns.
clear all
clc
tic
b = 1;
r = zeros(3268760,1);
load ('transp1.mat');
for i = 1:2
z1 = a(a(:,b) == 0, :);
s1 = sum(z1, 1);
s2 = max(s1);
r(b,1) = max(s1);
b = b + 1;
end
toc
Elapsed time is 209.340817 seconds.
My object is to gain to the results in "r" for all columns.
What I want of you is to decrease the time elapsed in the execution of script.
Can you help me please?
thank!

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by