It's been a little while since I've done matrix operations in MATLAB, so please forgive me if this is easily solvable.
I have some NxM matrix A
, and I would like to perform an operation on the column indices of A
. I know how to do this using a for
loop, but since I'm using MATLAB I'd like to make use of MATLAB's ability to do operations on matrices fast.
Suppose I have a function called myFunc
. Is there a way to do the following without a for
loop (such as with matrix multiplication):
for i=1:M
A(:, floor(i*myFunc())) = A(:, i)