Question

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?

Was it helpful?

Solution

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}) .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top