I have a cell array 1x7 and every matrix contains 5844x4double and they're all same size. Now i need to extract data from each cell array and each matrixe(5844x4double ) and t

5 views (last 30 days)
I have a cell array 1x7 and every matrix contains 5844x4double and they're all same size. Now i need to extract data from each cell array and each matrixe(5844x4double ) and the create other matrix containing the data from each cell array and each matrixe(5844x4double ). how can i do that ?
for i=1:length(cellarrray)
for j = 1:5844
dy_strfr1= rfdata_tsstrfr1{1,i}(1:j,4)
elv_strfr1= ellnlt_stallrfr1{1,i}(1:j,1)
lon_strfr1= ellnlt_stallrfr1{1,i}(1:j,2)
lat_strfr1= ellnlt_stallrfr1{1,i}(1:j,3)
end
end
  4 Comments
Stephen23
Stephen23 on 7 Apr 2022
"how can I attached the mat data?"
Save all relevant variables in one mat file. Then click the paperclip button in your answer/comment to upload it.

Sign in to comment.

Accepted Answer

Arif Hoq
Arif Hoq on 7 Apr 2022
how can I attached the mat data?
just right click on the mat file > save as > put any name.
here I have tried to make a cell array with random data.
a=randi(100,5844,4);
b=randi(200,5844,4);
c=randi(300,5844,4);
d=randi(400,5844,4);
e=randi(500,5844,4);
f=randi(600,5844,4);
g=randi(700,5844,4);
A={a;b;c;d;e;f;g}; % A is your cell array
B=[A{:}];
% expected variable
i1=B(:,1:4);
i2=B(:,5:8);
i3=B(:,9:12);
i4=B(:,13:16);
i5=B(:,17:20);
i6=B(:,21:24);
i7=B(:,25:28);
  3 Comments
Arif Hoq
Arif Hoq on 7 Apr 2022
try this:
A=load('rfdata.mat');
AA=A.rfdata_tsstrfr1 ;
rfdata=[AA{:}];
i1=rfdata(:,1:4);
i2=rfdata(:,5:8);
i3=rfdata(:,9:12);
i4=rfdata(:,13:16);
i5=rfdata(:,17:20);
i6=rfdata(:,21:24);
i7=rfdata(:,25:28);
B=load('elv_lon_lat.mat');
BB=B.ellnlt_stallrfr1;
stallrfr=[BB{:}];
x1=stallrfr(:,1:3);
x2=stallrfr(:,4:6);
x3=stallrfr(:,7:9);
x4=stallrfr(:,10:12);
x5=stallrfr(:,13:15);
x6=stallrfr(:,16:18);
x7=stallrfr(:,19:21);

Sign in to comment.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by