How can i divide the data in rows in MATLAB
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
Arif Hoq
il 2 Mar 2022
use reshape function
A=load('newdata.mat');
dataset=A.dataset;
output=reshape(dataset,16,[]);
8 Commenti
Med Future
il 2 Mar 2022
Arif Hoq
il 2 Mar 2022
try this one:
output=reshape(dataset,4,1000,[]);
Med Future
il 2 Mar 2022
Arif Hoq
il 2 Mar 2022
is that ?
output=reshape(dataset,16,1,[]);
Med Future
il 2 Mar 2022
Johan
il 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
il 2 Mar 2022
Ugh, do NOT concatenate row-by-row! That is an inefficient and complex approach.
Johan
il 2 Mar 2022
I did not think you could do that with transpose, thanks for the correction
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!