Hi all,
I'm looking for an algorithm to delete a specific row in a matrix. For example, matrix [J]:
[row1 - position 1
row2 - position 2
row3 - position 3
row4 - position 4
row5] - position 5
My current method is to continually swap rows until the row that needs to be deleted is at position 5, and then set the dimensions of [J] to 4. However, whenever I do this, it just deletes row 5.
Example run:
Try to delete row 2
position 2 and 3, swap
position 3 and 4, swap
position 4 and 5, swap
should now be
row1
row3
row4
row5
row2
Any help? Sorry if my explanation sucks, but I have no wish to send screenshots and stuff. I've verified that my code syntax and stuff is correct... maybe the way I swap rows isn't working?
-SW11
I'm looking for an algorithm to delete a specific row in a matrix. For example, matrix [J]:
[row1 - position 1
row2 - position 2
row3 - position 3
row4 - position 4
row5] - position 5
My current method is to continually swap rows until the row that needs to be deleted is at position 5, and then set the dimensions of [J] to 4. However, whenever I do this, it just deletes row 5.
Example run:
Try to delete row 2
position 2 and 3, swap
position 3 and 4, swap
position 4 and 5, swap
should now be
row1
row3
row4
row5
row2
Any help? Sorry if my explanation sucks, but I have no wish to send screenshots and stuff. I've verified that my code syntax and stuff is correct... maybe the way I swap rows isn't working?
-SW11