Find a length of string/array without length function
古いコメントを表示
Hi All,
Hope everyone is doing great. I have minor question, I am trying to write a simple function to find a length of string/array, of course without using length function of MATLAB.
I am trying to find if there is any condition related to error message index bound, then I can use it in loop. Any other ideas are more than welcome.
Thank you in advance.
採用された回答
その他の回答 (2 件)
Sean de Wolski
2012 年 2 月 15 日
str = 'hello world!';
max(size(str))
bym
2012 年 2 月 16 日
a variant on your code
str = 'hello world';
c =0;
while ~isempty(str)
c = c+1;
str(1)=[];
end
c
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!