Question: MATLAB, no iterations/conditionals Function Name: swaplndices Inputs: 1. [1xN Double] a vector Output: 1. [1xn Double] modified vector Description: 1. Write a function called swaplndices
MATLAB, no iterations/conditionals
Function Name: swaplndices Inputs: 1. [1xN Double] a vector Output: 1. [1xn Double] modified vector Description: 1. Write a function called swaplndices that takes in a vector and swaps the values at the even indices with the values at the odd indices and vice versa. It is guaranteed that the input vector will have an even number of indices. Examples: ans1 = swapIndices ([2739]) > ans1 = [7293] an2 = swapIndices ([51]) > ans2 = [15] ans3 = swapIndices ([654321]) > ans3 = [563412]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
