同じ値が連続する場合の条件
Show older comments
不連続に増加している行列で
「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の部分を簡略化できないでしょうか?
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!