# Deleting rows with specific values within a matrix

39 views (last 30 days)
Lewis Abrams on 6 Apr 2021
Commented: Matt J on 6 May 2021 at 18:28
Here is the given question:
Create a matrix, A, of dimension of random integers in the range . Now create a new matrix from A by removing any rows that contains either -10, 0, 10.
I have create the random matrix
A = randi([-10, 10], [7,12])
Despite looking online, I am yet to find anything similar.
Thanks for the help.
Matt J on 6 May 2021 at 18:28
A record of the original question:
Here is the given question:
Create a matrix, A, of dimension of random integers in the range . Now create a new matrix from A by removing any rows that contains either -10, 0, 10.
I have create the random matrix
A = randi([-10, 10], [7,12])
Despite looking online, I am yet to find anything similar.
Thanks for the help.

Matt J on 6 Apr 2021
Edited: Matt J on 6 Apr 2021
Hint: do something with this line:
ind = any( A==0 | abs(A)==10 ,2)
##### 2 CommentsShowHide 1 older comment
Matt J on 6 Apr 2021
abs() is absolute value.
c=abs([-10, 10])
c = 1×2
10 10
The line I've shown you really is by far the hardest part. If you don't know what to do from here, I think you need to review the Matlab on-ramp material.