A valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.
Input: S='vec=1:10;'; Output=10
Explanation: if you execute eval(S), a vector vec of length 10 will be generated. Similarly,
Input: S='a=[1 2 3 4 5];' Output=5
Input: S='a=ones(1,10);'; Output=10
Input: S='a=[];'; Output=0;
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers27
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
54071 Solvers
-
Find the numeric mean of the prime numbers in a matrix.
9179 Solvers
-
579 Solvers
-
Count decimal digits of a number
238 Solvers
-
Create the following sequence : 0 1 1 4 9 25 64 169 ...
206 Solvers
More from this Author44
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
The length of an empty array is 0 not []. ;-)
Sorry for that.. fixed it.. :)