comp.soft-sys.matlab
[Top] [All Lists]

vectorize cell array

Subject: vectorize cell array
From: ysjung
Date: Fri, 30 Sep 2005 12:08:34 -0400
Newsgroups: comp.soft-sys.matlab
Is there way I can vectoize for loop below? I noticed in cell array
you are limited when it comes to characters.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
strvec = {'Set' 'ASCIIIIIIII' 'textas' 'yuioop'};

for i = 1:length(strvec),
  num(i) = length(char(strvec(i)))
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

I am kinda looking for length of each character on this array, strvec
= [3 11 6 6];

the above code does the job, but just want to find out if there is
simpler way.

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy