How to use isfinite() to mark if entry of cell array is {0×0 double}
1 view (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Rik
on 26 Aug 2020
Why don't you want to use the isempty option in cellfun instead?
out=1-cellfun('isempty',gaitpar);
More Answers (0)
See Also
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!