MATLAB: Compare cell arrays and delete rows

MATLAB: Compare cell arrays and delete rows

compare cell arrays

I have two cell arrays: JFM06avg(1×2) and JFM06D(88×3). I want to compare the value from the first cell in the first row from the array JFM06avg(9.3576) to the each cell in the second column of the array JFM06D. Then if the value in JFM06D is less than the value of JFM06avg then the row must be deleted.Attached are the two files.

Best Answer

  • Here is one way:
    rowToDelete = [JFM06D{:,2}] < JFM06avg(1);
    JFM06D(rowToDelete,:) = [];
  • Add a Comment

    Your email address will not be published. Required fields are marked *