What is the data type of the output of the length function?
2 views (last 30 days)
Show older comments
I guess it is double, but why? Length is always an integer value!
0 Comments
Accepted Answer
Guillaume
on 13 Jun 2016
The default data type in matlab is double, not integer as in most compiled languages. array lengths, array indices, etc. are all stored as double.
Note that all integers up to flintmax (~9e15) can be accurately stored as double so it's not an issue at the moment. It'll be a while before computers have enough memory for it to become a problem.
0 Comments
More Answers (1)
Azzi Abdelmalek
on 13 Jun 2016
length(A) is always integer value, but the greatest integer value, is uint64(2^64-1). The length of an array could be greater then this value
2 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!