Issues with for loop
显示 更早的评论
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!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!