This question is closed. Reopen it to edit or answer.
How to solve "Index exceeds matrix dimensions" error?
1 view (last 30 days)
My question might be simple for most of you. Basically, I would like to delete a row of a matrix where a value of the elements in columns from 2 to 7 is zero. In doing so, I run the following command.
However, the error message comes up saying that "Index exceeds matrix dimensions.". I don't understand why it exceeds the dimension because I have already specified that i = 1 to the length of the matrix. Any help on this would be appreciated. Thank you.
I try also this codes but i have the same problems
Eng. Fredius Magige on 27 Oct 2015
Hi It might need to recalling as ready reduced the row, thus try this:
StayCell=StayCell for i=1:size(StayCell,1) if StayCell(i,2:7)==0 StayCell(i,:)=; end StayCell=(StayCell, [ ]) end