Compare two cell arrays of different sizes

7 views (last 30 days)
I have two cell arrays of different sizes final_iono=68x2 cell and final_gps=288x2 cell as follows:
final_iono= Column 1('00:05','00:10','00:15'...) and Column 2 ([7.62],[7.78],[7.50]...);
final_gps= Column 1('00:05','00:20','00:35'...) and Column 2 ([109.56],[107.24],[98.22]...).
I need to compare the Column 1 of the cell array final_gps with cell array final_iono, and create a new cell array C using the following math operation:
C= Col1('00:05'), then Col2= (7.62^3/109.56) then, Col2= 4.038
So,
C= '00:05' [4.038]
Follow below an example.
Any help will be appreciate!

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 7 Dec 2013
Edited: Andrei Bobrov on 8 Dec 2013
[l,ii] = ismember(final_gps(:,1),final_iono(:,1));
C = cat(1,final_gps{l,2}).^3./cat(1,final_iono{ii(l),2});
ADD
l = ismember(final_gps(:,1),final_iono(:,1));
C = cat(1,final_gps{l,2}).^3./cat(1,final_iono{:,2});
  6 Comments
chocho
chocho on 10 Mar 2017
Edited: chocho on 10 Mar 2017
Hi @Andrei Bobrov friend, i have the same case but cell inside cell like cell array1 size 200*1 (column vector array:row=200 and col=1) but inside each row also 1*3 cell .
how could i get access the those elements using a loop?

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Identification 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!