How to delete specific rows in this matrix?
Show older comments
So I have a set of data with which I converted into a matrix. In this matrix I have to delete rows who's average is less than 50. I run a for loop like this:
filename = '/home/kelm/uegabe/Alle/Muringayi/Tactile Sensor Robot Measurements/S1M1/2017-7-18_111304.txt';
m = importdata(filename);
m(:,1) = [];
for i = 1:size(m,1)
avg = mean(m(i,:));
if avg < 50
m(i,:) = [];
continue
end
end
However, all I get back is index exceeds matrix dimensions. I am also able to cut down on some of the rows who's average is less than fifty because the number of rows in my matrix goes from 717 to 426, but there are still more that remain. Does anyone know where I am going wrong and how I can delete the appropriate rows?
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!