To delete a row in an array if it contains a 0 in MATLAB, you can use logical indexing along with the ~
(logical NOT) operator.
Here is an example of how to do it:
main.m194 chars12 lines
This will delete all rows in the array A
that contain at least one 0. The result will be displayed in the command window.
Note that this method assumes you want to delete entire rows. If you want to delete individual elements containing 0 instead, you can use linear indexing instead of logical indexing.
gistlibby LogSnag