Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: which cells are numeric?

$
0
0
On 7/10/2013 12:47 PM, Steven_Lord wrote:
> "Bruce Bowler" <bbowler@bigelow.org> wrote in message
> news:b45k05FqaeoU1@mid.individual.net...
>> ... I have a cell array, let's call it c. ...
...
>> how can I create d, ... a logical array that

[is true for numeric cells in c?]

>
> c = {1,2,3,'four',5,6,7,8,9};
> d = cellfun(@isnumeric, c)
> onlyNumericElementsOfC = c(d) % Anticipating the next step
> onlyNonnumericElementsOfC = c(~d)
>
> *snip*
>

OK, Steven, no fair!!! Just when I had posted a practice successful
cellfun() you beat posting time by ~7 min...

:)

--

Viewing all articles
Browse latest Browse all 19628

Trending Articles