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!

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2013년 12월 7일
편집: Andrei Bobrov 2013년 12월 8일

0 개 추천

[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

Hi Andrei! The ismember and cat command worked perfectly, but I had to change the second line to read all rows, I did:
C=cat(1,final_gps{:,2}).^3./cat(1,final_iono{ii(:),2});
but appears the following error:Subscript indices must either be real positive integers or logicals. I need also the program shows the C matrix as previous figure (HH:MM)col1 and (value)col2. Can you help me again? Thanks in advance
Andrei Bobrov
Andrei Bobrov 2013년 12월 8일
see ADD
Andrei, only the value 7.621 (final_gps at 00:05) is taking part of the math operation. For example, when final_gps at 00:20 the value 7.1643 must divided by 107.2476 as shows on figure above. I tried to change the line into C=cat(1,final_gps{ii,2})..., but it didn't work.
Andrei Bobrov
Andrei Bobrov 2013년 12월 9일
편집: Andrei Bobrov 2013년 12월 9일
Code in block ADD working? Please attach file with you data (mat - file)
Marcelo Duarte
Marcelo Duarte 2013년 12월 11일
It worked Andrei... Thanks a lot.
chocho
chocho 2017년 3월 10일
편집: chocho 2017년 3월 10일
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?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2013년 12월 7일

편집:

2017년 3월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by