how to use if else of for loops to manipulate matrices

조회 수: 1 (최근 30일)
selassie ngara
selassie ngara 2015년 12월 1일
댓글: selassie ngara 2015년 12월 1일
i have a two column matrix (many rows) and i want to read column 1 values corresponding with certain values in column 2 under a certain condition that only column 2 can be tested. say column 2 must be over 3.4 and i want times corresponding(column1)

채택된 답변

Thorsten
Thorsten 2015년 12월 1일
편집: Thorsten 2015년 12월 1일
To get all values from column 1 of X, where column 2 is > 3.4:
x = X(X(:,2) > 3.4, 1);
  댓글 수: 1
selassie ngara
selassie ngara 2015년 12월 1일
thanks, it makes sense but it takes a whyle to get your head arnd it

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

추가 답변 (1개)

Eng. Fredius Magige
Eng. Fredius Magige 2015년 12월 1일
For can assist you in searching each index in sequence order through find function as long you know/specify appropriate condition to be determine by if else. Note that find function return to you raw and column, in many case column will 1 always.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by