필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Form a matrix from elements of a second matrix

조회 수: 2 (최근 30일)
Shashank
Shashank 2012년 10월 22일
마감: MATLAB Answer Bot 2021년 8월 20일
Suppose if I have a matrix like this:
Time = [1;2;3;4;5;6;7;8;9;10]
Diameter = [1;2;3;4;5;6;7;8;9;10]
If I want to form two matrices, one for diameters less than 6 and other for diameters greater than 6, how can I do that? I also need times for the corresponding diameters on each matrix.
Thanks.

답변 (1개)

Matt Fig
Matt Fig 2012년 10월 23일
편집: Matt Fig 2012년 10월 23일
Your question is a little unclear, but I think you can get what you want with logical indexing.
idx = Diameter<6; % A logical index.
D1 = Diameter(idx);
T1 = Time(idx);
D2 = Diameter(~idx);
T2 = Time(~idx);

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by