Issues with for loop
Show older comments
I currently have this for loop in my code. Where RawDataMatrix is a 549x41 matrix.
for i = 1:length(RawDataMatrix(:,1))
if RawDataMatrix(i,35) > 10
RawDataMatrix(i,:) = [];
else
end
end
RawDataMatrix(:,35) = [];
I want this loop to go through each row and if the value of that row at column 35 is greater than 10 I want to delete the entire row from the matrix. Then after that I would like to delete the entire column 35 which is what that last line of code is for. I am currently getting this error code:
Index in position 1 exceeds array bounds (must not exceed 549).
Error in SEMMaster_DustIncluded_EdgeExcluded_withCuK_V1 (line 31)
if RawDataMatrix(i,35) > 10
I believe I am getting this error because in the workspace it says that i = 550 which I am not sure why. Thank you in advance if you can help me!
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!