|
Anne <deutschlover@gmail.com> wrote in message <de12ec67-368f-4ea5-8ae7-510792f1e08e@l35g2000vba.googlegroups.com>...
> Hi All,
> As a newbee of Matlab, I apologize if this question sounds too
> naive...
>
> I have a cell array, ctrynames, of 24 country names, and another cell
> array 'all_ctry' with 1875 country names in it. The classes are:
>
> ctrynames <1*24> cell
> all_ctry <1875*1> cell
>
> Now I want to find where the countries in ctrynames lie in all_ctry. I
> used this function
>
> for i=1:24
> indices=strmatch(ctrynames(i),all_ctry(:,1));
> end
>
> But indices always return empty. Would you please enlight me why is
> that? Thank you very much
On each iteration of the for-loop you overwrite the previous result in "indices", like this
for i=1:3
r1 = rand(i,1) ;
end
r1
whereas you might want
for i=1:3,
r2{i} = rand(i,1) ;
end
r2
I suspect
strmatch(ctrynames(end),all_ctry(:,1))
to be empty ...
hth
Jos
|