How can i divide the data in rows in MATLAB
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (1)
Arif Hoq
le 2 Mar 2022
use reshape function
A=load('newdata.mat');
dataset=A.dataset;
output=reshape(dataset,16,[]);
8 commentaires
Med Future
le 2 Mar 2022
Arif Hoq
le 2 Mar 2022
try this one:
output=reshape(dataset,4,1000,[]);
Med Future
le 2 Mar 2022
Arif Hoq
le 2 Mar 2022
is that ?
output=reshape(dataset,16,1,[]);
Med Future
le 2 Mar 2022
Johan
le 2 Mar 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
le 2 Mar 2022
Ugh, do NOT concatenate row-by-row! That is an inefficient and complex approach.
Johan
le 2 Mar 2022
I did not think you could do that with transpose, thanks for the correction
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!