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
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:2| Question number:12.2
All Answers
total answers (1)
>> 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