creating an array from an object
Show older comments
Hi,
I have an object which comes from a database and is in the following format
cats 100 200 300 100 dogs 50 100 110 80 mice 80 30 40 200
I am using cell2mat to create matrices from the object for coloumns 2 - 5 - however you cannot mix strings and numbers and infact you cant even get a matrix of coloumn 1 ie the strings cats, dogs, mice. I need to create a separate matrix - or I believe it will be called an array in this instance that returns underneath each other all the strings from coloumn 1.
Many thanks
Accepted Answer
More Answers (2)
Azzi Abdelmalek
on 17 Apr 2013
s={'cats' 100 200 300 100 'dogs' 50 100 110 80 'mice' 80 30 40 200}
out=s(cellfun(@isstr,s))
1 Comment
matthew arnott
on 17 Apr 2013
matthew arnott
on 17 Apr 2013
0 votes
Categories
Find more on Characters and Strings 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!