Find entire rows in a matrix where a column value meets a certain condition
3 次查看(过去 30 天)
显示 更早的评论
I have a matrix (4columns, ~50000 rows) and I want a new matrix that will only return the (entire) rows (values, not row number) where column 4 = 101300 (to 4s.f).
Any help appreciated.
VLE1(ii,:)=[x1 x2 T P]
0 个评论
采纳的回答
Guillaume
2016-10-19
filteredmatrix = originalmatrix(round(originalmatrix(:, 4), 4, 'significant') == 101300, :);
is all that is needed.
更多回答(1 个)
Massimo Zanetti
2016-10-19
Assume your 50000x4 matrix is A, this will remove all the rows such having 4th element = 101300:
A(A(:,4)~=101300,:)=[];
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!