Conditional find in matlab
1 次查看(过去 30 天)
显示 更早的评论
I = find(X == a,1,'first'), J = find(X == b,1,'first'), K = find(X == c,1,'first') provided that K > J > I How can I implement the conditional part? Thanks in advance.
0 个评论
采纳的回答
Les Beckham
2024-1-18
编辑:Les Beckham
2024-1-18
X = [10 20 30 40 50 10 20 30 40 50];
a = 30;
b = 20;
I = find(X == a, 1, 'first')
J = find(X((I+1):end) == b, 1, 'first') + I % start search after index I
X(I)
X(J)
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!