MATLAB: How to remove some elements from a matrix

arrayMATLABmatrixremove

Hi everyone
Now I have a matrix which has two columns and several rows.
How can I remove the rows which contains value that read 0 and create a new matrix?
Any help would be really appreciated!

Best Answer

The find function with two outputs is helpful here:
M = randi([0 10], 20, 2); % Create Data
[r,~] = find(M == 0); % Rows With ‘0’
M(r,:) = []; % Delete Rows With ‘0’