code:
unused_rows=1:12while ~isempty(unused_rows)rows_matrix=reshape(unused_rows,[],2)rows_matrix(:,end)=rows_matrix(end:-1:1,end)for k=1:size(rows_matrix,1) rows=rows_matrix(k,:) unused_rows=[];endend
The above code executes and gives me the result.
with respect to the command line
rows_matrix=reshape(unused_rows,[],2)
I am getting the result to be
rows_matrix = 1 7 2 8 3 9 4 10 5 11 6 12
But I want to display the result in the following manner.
rows_matrix = 1 9 2 8 3 7 4 12 5 11 6 10
Could anyone please help me on this.
Best Answer