MATLAB Answers

Adding to the first value in a matrix based on the second value in that row.

조회 수: 1(최근 30일)
Toby
Toby 7 Jan 2020
답변: Alex Mcaulley 7 Jan 2020
I have a matrix which has 4 columns and a number of rows. I simply want to add 1 to the value in the first column of a row if the second column has the value of 11 or 12 in it.

  댓글 수: 0

로그인 to comment.

채택된 답변

Alex Mcaulley
Alex Mcaulley 7 Jan 2020
Being A your matrix:
A(A(:,2) == 11 | A(:,2) == 12,1) = A(A(:,2) == 11 | A(:,2) == 12,1) + 1

  댓글 수: 0

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

태그


Translated by