How to Split a 50000x2 data in .mat into 100 equal-sized 500x2 data?

1 Ansicht (letzte 30 Tage)
Dear community,
I am trying to split a 50000x2 data in .mat into 100 equal-sized 500x2 data (that will allow me to plot 100 figures afterwards)
Wish to get help from you all.
Thank you.

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 5 Nov. 2020
This code shows an example of how it can be done
M = rand(50000,2);
C = mat2cell(M, 500*ones(100,1), 2);
figure()
for i = 1:numel(C)
subplot(10,10,i)
plot(C{i}(:,1), C{i}(:,2))
end
  8 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Matt J
Matt J am 6 Nov. 2020
One way is to use mat2tiles. For example
A=rand(50000,2);
Asplit=mat2tiles(A,[500,2]);
whos A Asplit
Name Size Bytes Class Attributes
A 50000x2 800000 double
Asplit 100x1 811200 cell

Kategorien

Mehr zu Cell Arrays 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!

Translated by