copy element position from one vector to another

2 ビュー (過去 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 Center および File ExchangeLogical についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by