Write a function called ReturnOddEntries.m that accepts as inputa column or row array (vector) and returns only the odd indexentries. Do this by first setting the even entries to 0, and thenremoving the 0 entries by using a logical array. The first line ofyour code should read
function p = ReturnOddEntries(p)
For example, if you run in the command window p =ReturnOddEntries([1.2 7.1 8.4 -42 100.1 7 -2 4 6]), then you shouldget
p = [1.2 8.4 100.1 -2 6]