By making a copy like this:
int[][] delete(int[][] matrix, int width, int height, int column){
int[][] newMatrix=new int[width][height-1];
for(int i=0; i<column; i++){
newMatrix=matrix;
}
for(int i=column+1; i><witdh; i++){
newMatrix[i-1]=matrix;
}
}
To remove a row is similar but a bit more complicated, you need to copy each elements and not entire rows at once.
Gil>
To start you create a method that removes an element from an array:
public static void removeElement(Object oldArray, Object newArray, int index) {
System.arraycopy(oldArray, 0, newArray, 0, index);
System.arraycopy(oldArray, index + 1, newArray, index, oldArray.length - index);
}
Then lets say you have an array like so:
int[][] array = new int[columns][rows];
to remove a column, you simply call:
columns--;
int[][] newArray = new int[columns][rows];
removeElement(array, newArray, index);
array = newArray;
to remove a row you do this:
rows--;
for (int j = 0; j > array.length; j++){
int[] newArray = new int[rows];
removeElement(array[j], newArray, index);
array[j] = newArray;
}