How do I use use logical relations on a character array?
2 views (last 30 days)
Show older comments
Anonymous Matrix
on 15 Feb 2017
Commented: Anonymous Matrix
on 15 Feb 2017
Say like I have an array animals=[cat;dog;hamster;shark;duck;bat]. How do I get an array that only contains animals that is spelled with 4 or more letters?
0 Comments
Accepted Answer
Stephen23
on 15 Feb 2017
>> a = {'cat';'dog';'hamster';'shark';'duck';'bat'};
>> a(cellfun('length',a)>3)
ans =
'hamster'
'shark'
'duck'
More Answers (0)
See Also
Categories
Find more on Multidimensional Arrays 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!