copy element position from one vector to another

조회 수: 4 (최근 30일)
Bianka Markovic
Bianka Markovic 2021년 7월 6일
답변: KSSV 2021년 7월 6일
Hello everyone,
I'm trying to find a way where i copy the positions of NaN values in a onto the same positions in b. Does anyone has a suggestion what could work?
Thank you!
a=rand(100,1);
a(20:30)=nan;
a(60:80)=nan;
b=rand(100,1);

답변 (1개)

KSSV
KSSV 2021년 7월 6일
a=rand(100,1);
a(20:30)=nan;
a(60:80)=nan;
b=rand(100,1);
b(isnan(a)) = NaN ;

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by