سؤال

I have a cell array ab, where ab(1)='01'. MATLAB gives me that length('01')=2, but that length(ab(1))=1. Why is this? How can I make it not so?

هل كانت مفيدة؟

المحلول

the length of the first element in cell array ab is 1, because it is a single element. If you want the length of the contents of that element you need to use curly brackets, such as, length(a{1}) .

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top