reverseCols - matrix1,2:2:end)=%removes the even columns...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function new_matrix=reverseCols(matrix1) %function that flips every column with an even index of the given matrix %upside-down %usage: [new_matrix]=reverseCols(matrix1) matrix1(:,2:2: even_columns=(matrix1(:,2:2:end)); %gets the even columns from matrix1 flip_even=even_columns(end:-1:1,:); %flips the even columns from matrix1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: matrix1(:,2:2:end)=; %removes the even columns from matrix1 new_matrix(1:length(matrix1).*2,1:2:length(matrix1).*2)=matrix1(:,:); %assigns the odd columns the values from matrix1 new_matrix(1:length(matrix1).*2,2:2:length(matrix1))=flip_even(:,:); %assigns the even columns the values from flip_even...
View Full Document

Ask a homework question - tutors are online