This should solve your problem.
matrix=randi(100,[50 50]);
rows2remove=[2 4 46 50 1];
cols2remove=[1 2 5 8 49];
matrix(rows2remove,:)=[];
matrix(:,cols2remove)=[];
On the second thought, if you have indices, then first convert those indices to subscripts by using the function ind2sub
as:
[rows2remove,cols2remove] = ind2sub(size(matrix),VecOfIndices);
Now you will get row and column indices of elements which need to be removed. Individual elements cannot be removed from a matrix. So I am assuming that you need to remove the entire column and row. That can be done as:
rows2remove=unique(rows2remove);
cols2remove=unique(cols2remove);
matrix(rows2remove,:)=[];
matrix(:,cols2remove)=[];
If you want to remove individual elements then either use a cell array or replace those elements with some obsolete value such as 9999.