How to use isfinite() to mark if entry of cell array is {0×0 double}

13 ビュー (過去 30 日間)
ZimtBolten
ZimtBolten 2020 年 8 月 26 日
コメント済み: ZimtBolten 2020 年 8 月 26 日
Hello, I have problems with the following part of my code:
"gaitpar" represents all of my paramteres listed in Results.(reg_cats{c}).Parameter.(wanted{w}).(ParName)
>> gaitpar = arrayfun(@(x) x.(ParName),Results.(reg_cats{c}).Parameter.(wanted{w}),'UniformOutput',false);
example:
>> gaitpar'
ans =
28×1 cell array
{[ 1.1972]}
{[ 1.3210]}
{[ 1.2991]}
{[ 1.2173]}
{[ 1.2618]}
{[ 1.1945]}
{[ 1.2525]}
{[ 1.2423]}
{[ 1.2174]}
{[ 1.1083]}
{[ 0.8304]}
{[ 1.2841]}
{[ 1.2616]}
{[ 1.6553]}
{[ 1.3607]}
{[ 1.4981]}
{[ 1.1102]}
{[ 0.9010]}
{[ 1.1059]}
{[ 1.1211]}
{[ 1.3518]}
{[ 1.0669]}
{[ 1.0120]}
{[ 1.3397]}
{[ 1.0557]}
{[ 1.2142]}
{0×0 double}
{[ 1.2595]}
Now I would like to use isfinite() to get 1 if there is an entry and 0 if there is an {0×0 double}-entry.
But isfinite(gaitpar') leads to:
Undefined function 'isfinite' for input arguments of type 'cell'.
(If I use an
How can I fix this problem?
Thank you in advance!

採用された回答

Rik
Rik 2020 年 8 月 26 日
Why don't you want to use the isempty option in cellfun instead?
out=1-cellfun('isempty',gaitpar);

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by