I am currently using squeeze to remove two singleton sizes from a matrix. The matrix is ββa large 4d matrix M(:,:,:,:) . The first two dimensions are the coordinates of the rows and columns ( y and x ). A variable in the third dimension ( indexes ) selects several values ββin the third dimension M
In the loop that I run, the matrix M is addressed as M(y,x,indexes,:) , which makes the first two dimensions one-dimensional. These sizes are then removed using squeeze for use in pdist , for example:
pdist(squeeze(M(y,x,indexes,:)))
Is it possible to vectorize the use of squeeze in this case? (It takes a lot of time in the loop)
user1218247
source share