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;
The length of an empty array is 0 not []. ;-)
Sorry for that.. fixed it.. :)
Least common multiple of many numbers
159 Solvers
Back to basics 3 - Temp Directory
277 Solvers
Back to basics 25 - Valid variable names
253 Solvers
Determine value using Look-up table method
36 Solvers
55 Solvers