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

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

Your question is not clear. Are the matrices in the your cell array? Describe how you want to extract the data from each matrix within your cell array and how you want to store the extracted data.
@Arif Hoq how can I attached the mat data?
@David Hill ya, I want to extract the data from each matrix within my cell array and store the extracted data in the matrix. forexample I do have {5844x4double, 5844x4double, 5844x4double, 5844x4double, 5844x4double, 5844x4double, 5844x4double} now i want to extract one data from each cell arra and stor it as [i1; i2; i3; i4; i5; i6; i7].
"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

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 now i would like to take data for each day and each station(cell) and then store
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

Tags

Community Treasure Hunt

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

Start Hunting!