help with ordering tables

조회 수: 1 (최근 30일)
Jules Ray
Jules Ray 2011년 11월 29일
dear colleages... i have a problem with a table... here is the problem....
i got a table named depth:
depth(:,1)=a1;
depth(:,2)=g1;
i need to create two new tables (submarine and aerea) each one composed by selected values of the table depth and also composed by two columns each one:
for submarine: i need all negative values of the second column of depth (depth(:,2), with each corresponding value of the first colum of depth (depth(:,1).
for aerea: the same but positve values...
i prepare this but dosent work
submarine=find((depth(:,2)<0,:));
aerea=find((depth(:,2)>0,:));
i think, find is not correct to be used in this case.... but what can i use?
thanx

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 29일
submarine = depth(depth(:,2)<0, :);
aerea = depth(depth:,2)>0, :);
Question: what if the depth was exactly 0 ?
  댓글 수: 1
Jules Ray
Jules Ray 2011년 11월 29일
if depth=0 is aerea
thanx

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

추가 답변 (0개)

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by