How can i divide the data in rows in MATLAB
Show older comments
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
Accepted Answer
More Answers (1)
Arif Hoq
on 2 Mar 2022
use reshape function
A=load('newdata.mat');
dataset=A.dataset;
output=reshape(dataset,16,[]);
8 Comments
Med Future
on 2 Mar 2022
Arif Hoq
on 2 Mar 2022
try this one:
output=reshape(dataset,4,1000,[]);
Med Future
on 2 Mar 2022
Arif Hoq
on 2 Mar 2022
is that ?
output=reshape(dataset,16,1,[]);
Med Future
on 2 Mar 2022
Johan
on 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
on 2 Mar 2022
Ugh, do NOT concatenate row-by-row! That is an inefficient and complex approach.
Johan
on 2 Mar 2022
I did not think you could do that with transpose, thanks for the correction
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!