채택된 답변

David Goodmanson
David Goodmanson 2025년 9월 20일
편집: David Goodmanson 2025년 9월 21일

1 개 추천

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

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.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

AIRTON
AIRTON 2025년 9월 20일
편집: Walter Roberson 2025년 9월 20일

0 개 추천

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

Hi Airto
I believe that both methods have transposed the matrix correctly, and you can use 'b' to continue your work since it has been saved.
This matrix can't be displayed because it has too many elements so that it reach the limit of variable editor.
If you want to check whether the transposition is correct, you might use
size(b)
If you want to see the element in first 10 rows or first 10 columns, you might use
b(:, 1:10)
b(1:10, :)
If you have to check all the elements within it, you might try
writematrix(b, 'filename.csv')%shoule be opened with excel or python
% or
save('filename.mat', 'b', '-v7.3')
However, since the number of elements within the matrix is 3 times 3500000, both documents will be very huge (maybe more than 6GB, I guess). In addition, they might also be hard to open...
AIRTON
AIRTON 2025년 9월 20일
Hy Chun
great, very good!
I have got to access the data.
Thank you very much!
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.

댓글을 달려면 로그인하십시오.

AIRTON
AIRTON 2025년 9월 20일
편집: Walter Roberson 2025년 9월 20일

0 개 추천

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!

카테고리

도움말 센터File Exchange에서 Function Creation에 대해 자세히 알아보기

질문:

2025년 9월 20일

편집:

2025년 9월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by