Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

classification of a cell of string

Status
Not open for further replies.

patriote

Electrical
Joined
Nov 10, 2005
Messages
3
Location
GB
Hello,

I have a cell (n x 1) with "p" different string (like below) and I wanna have "p" cells, where each cell contains only the same string. (I don't know a priori the number "p")
How can I do that?
Thanks

cell:
'blCarN'
'blCarN'
'blCarN'
'blCarN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'blCarN'
'whVanN'
'whVanN'
'whVanN'
'blTrkF'
'whVanN'
'blTrkF'
'whVanN'
'blTrkF'
'whVanN'
'blTrkF'
'whVanN'
'gyCarN'
'blTrkF'
'whVanN'
'gyCarN'
'blTrkF'
'whVanN'
 

Hi,

A={...}; % your cell array

str=unique(A);

for n=1:length(str)

B{n}=A(strcmp(A,str{n}));

end


Hope this helps
Jérôme
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top