How can I build a vector B with the longest consectutive array of vector A which has multiple consecutive numbers (e.g.[2 5 6 7 10 12 13 20])? In this example the answer should be B= 5 6 7
MATLAB: Create vector containing longest consecutive array of different vector
longest consecutive number vector
Best Answer