Find and changing element in matrix (double).

I have a 10x10 matrix (double). I would like to check on a specific column (example column 1) for an element which value is equal to 2 (example) and then change the corresponding element in the same row but different column (example column 2) to 0. How can i do this?

 채택된 답변

Birdman
Birdman 2018년 3월 22일
편집: Birdman 2018년 3월 22일

0 개 추천

A(A(:,1)==2,2)=0
or
A(ismember(A(:,1),2),2)=0

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

질문:

2018년 3월 22일

편집:

2018년 3월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by