Suppose I have a Matlab matrix A(x,y) which is square matrix with size N+1.
I want a new matrix B, whose element B(x,z) is A(x,N-x-z), and in case x+z>N, B(x,z) is just zero.
Of course I can do it using a 2-level for loop, but for the sake of performance, I want to know if there is a 'vectorized' method to finish this job.
Edit 1:
All indices mention above start from 0.
Edit 2:
If the indices start from 1 instead of 0, the question can reformulated as follows:
I have a Matlab matrix A(i,j) which is a square matrix with size N+1.
I want a new matrix B, whose element B(i,k) is A(i,N+3-i-k), and in case i+k>N+2, B(i,k) is just zero.
xandzstarting at 1 or at 0? - Luis Mendo0in MATLAB? - Divakarx+z=N? Can you give sample input-output? - Divakar