Q:

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)

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

>> 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

total answers (1)

Similar questions


need a help?


find thousands of online teachers now