Create a vector variable vec. Find as many expressions as you can that would refer to the last element in the vector, without assuming that you know how many elements it has (i.e., make your expressions general)
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:2| Question number:20.2
All Answers
total answers (1)
>> vec = 1:2:9
vec =
1 3 5 7 9
>> vec(end)
ans =
9
>> vec(numel(vec))
ans =
9
>> vec(length(vec))
ans =
9
>> v = fliplr(vec);
>> v(1)
ans =
9
need an explanation for this answer? contact us directly to get an explanation for this answer