How can i divide the data in rows in MATLAB
Ältere Kommentare anzeigen
hello everyone, i hope you are doing well.
I have dataset of shape 4x4000;
i want to divide the data in rows like each row contain 1000 samples not 4000
so output shape is 16x1000
how can i do it in matlab
Akzeptierte Antwort
Weitere Antworten (1)
Arif Hoq
am 2 Mär. 2022
use reshape function
A=load('newdata.mat');
dataset=A.dataset;
output=reshape(dataset,16,[]);
8 Kommentare
Med Future
am 2 Mär. 2022
Arif Hoq
am 2 Mär. 2022
try this one:
output=reshape(dataset,4,1000,[]);
Med Future
am 2 Mär. 2022
Arif Hoq
am 2 Mär. 2022
is that ?
output=reshape(dataset,16,1,[]);
Med Future
am 2 Mär. 2022
Johan
am 2 Mär. 2022
If you want to concatenate row by row then you can use:
res = [];
for i = 1:size(dataset,1)
res = [res;reshape(dataset(i,:),[],1000)];
end
Stephen23
am 2 Mär. 2022
Ugh, do NOT concatenate row-by-row! That is an inefficient and complex approach.
Johan
am 2 Mär. 2022
I did not think you could do that with transpose, thanks for the correction
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!