find Nan in cell

2 ビュー (過去 30 日間)
NA
NA 2019 年 7 月 11 日
コメント済み: madhan ravi 2019 年 7 月 11 日
I want to find nan element in A,
A={[],[],[31],[2,1]}; %first case
A1={[],[2],[3],[6]}% second case
I used this code, but did not give me the correct answer
P=cellfun(@(x) isnan(x),A,'UniformOutput',false);
after that, check if first and second elemnt is nan, put A as [];
aswer should be
A=[] % first case
A1={[],[2],[3],[6]}% second case
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 7 月 11 日
Check here
madhan ravi
madhan ravi 2019 年 7 月 11 日
Provide an another example, as I understand A should contain [] as many [] are observed in A1 ? Is that true?

サインインしてコメントする。

採用された回答

KSSV
KSSV 2019 年 7 月 11 日
編集済み: KSSV 2019 年 7 月 11 日
Use isempty..not isnan
A={[],[],[31],[2,1]}; %first case
A1={[],[2],[3],[6]}% second case
P=cellfun(@(x) isempty(x),A,'UniformOutput',false)
  3 件のコメント
KSSV
KSSV 2019 年 7 月 11 日
Such function do not exist.
NA
NA 2019 年 7 月 11 日
A={[],[],[31],[2,1]};
P=cellfun(@(x) isempty(x),A,'UniformOutput',false);
if P{1}==1& P{2}==1
A=[];
end
is it a correct way to do this?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by