Q:

write an expression that refers to only the elements that have oddnumbered subscripts in a vector, regardless of the length of the vector. Test your expression on vectors that have both an odd and even number of elements

0

write an expression that refers to only the elements that have odd-numbered subscripts in a vector, regardless of the length of the vector. Test your expression on vectors that have both an odd and even number of elements. 

All Answers

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

>> vec = 1:8;

>> vec(1:2:end)

ans =

 1 3 5 7

>> vec = 4:12

vec =

 4 5 6 7 8 9 10 11 12

>> vec(1:2:end)

ans =

 4 6 8 10 12

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