필터 지우기
필터 지우기

How to replace certain values in matrix ?

조회 수: 3 (최근 30일)
Pritha Pande
Pritha Pande 2017년 10월 2일
댓글: Pritha Pande 2017년 10월 2일
I have attached two .jpg files below. In first one i have values and some NaN values, in second file i.e 2_mass, i have matrix all filled with values. I want 2_mass.jpg file to show the NaN values at the same point as seen in 1_mass.jpg file and but other values should remain same. the final output should look like as shown in 3_mass.jpg

채택된 답변

Akira Agata
Akira Agata 2017년 10월 2일
Assuming A, B and C are your 1_mass, 2_mass and 3_mass matrix, the solution will be like:
C = B;
idx = isnan(A);
C(idx) = NaN;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by