How the replace values in one matrix by comparision with another?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi Matlab users,
My problem is this: I have 2 matrix of the same size let's say A=(238;132;70) and B=(238;132;70). They have different contents but matrix A has the number -99 a lot of times in it (which represents land) and matrix B has also the number -99 in it, but fewer values. How can I make so that matrix B will keep it's own values, except for the points where matrix A has -99 value, case in which it will write -99?
Best regards,
Robert.
댓글 수: 0
채택된 답변
Image Analyst
2012년 5월 26일
% Get a logical map of where -99 occurs in A
locations99inA = (A == -99);
% Assign ONLY THOSE locations in B to be 99
% leaving all other elements of B unchanged.
B(locations99inA) = -99;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!