Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski 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
Nov 10, 2005
3
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'
 
Replies continue below

Recommended for you


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