how to create matrix of string and use it in mathematic operation?

 Accepted Answer

Use a cell array of strings for b and use logical indexing instead of a.*b,
>> b={'ben';'james';'mike';'ralph';'will'};
>> a=logical([1;0;1;1;0]);
>> b(a)
ans =
'ben'
'mike'
'ralph'

More Answers (1)

Speaking of mathematical operations with strings, ever wonder what you get when you cross a cat with an owl?
>> cross('cat','owl')
ans =
-3328 2184 1014

Categories

Tags

Asked:

eri
on 24 Oct 2012

Community Treasure Hunt

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

Start Hunting!