同じ値が連続する場合の条件
显示 更早的评论
不連続に増加している行列で
「n-10~nが同じ値」 かつ 「n~n+5がすべて異なる」n~n+10を抽出したいです。
a = [1 2 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20].'
の [4 5 6 7 8 9 10 11 12 13] を抜き出したい。
for n = 10:length(a)-5
if a(n,1)==a(n-1,1)&&a(n,:)==a(n-2,1)、、、&&a(n,:)==a(n-10,1)&&a(n,1)~=a(n+1,1)、、&&a(n,1)~=a(n+5,1)
そこで上記の条件式を組んだのですが、ifの部分を簡略化できないでしょうか?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!