how to use if else of for loops to manipulate matrices

1 Ansicht (letzte 30 Tage)
selassie ngara
selassie ngara am 1 Dez. 2015
Kommentiert: selassie ngara am 1 Dez. 2015
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)

Akzeptierte Antwort

Thorsten
Thorsten am 1 Dez. 2015
Bearbeitet: Thorsten am 1 Dez. 2015
To get all values from column 1 of X, where column 2 is > 3.4:
x = X(X(:,2) > 3.4, 1);
  1 Kommentar
selassie ngara
selassie ngara am 1 Dez. 2015
thanks, it makes sense but it takes a whyle to get your head arnd it

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Eng. Fredius Magige
Eng. Fredius Magige am 1 Dez. 2015
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.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by