Sie verfolgen jetzt diese Einreichung
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
NCONSEC = NCONSECUTIVE(X) returns a vector containing the maximum number of consecutive integers in each row of matrix x.
Note that while this code is not vectorized, it was tested against two different vectorized versions; the for-loop code ran about twice as fast as the vectorized versions.
Example:
nconsec = nconsecutive([1 2 3 5 6 7; 8 7 6 2 4 1; 2:7; 9:-1:5 5])
Editor's Note: You might want to try vectorizing this to work along the columns instead of along the rows; since MATLAB is column major this may be more effective.
Zitieren als
Brett Shoelson (2026). nconsecutive (https://de.mathworks.com/matlabcentral/fileexchange/1006-nconsecutive), MATLAB Central File Exchange. Abgerufen .
Allgemeine Informationen
- Version 1.0.0.0 (1,43 KB)
Kompatibilität der MATLAB-Version
- Kompatibel mit allen Versionen
Plattform-Kompatibilität
- Windows
- macOS
- Linux
| Version | Veröffentlicht | Versionshinweise | Action |
|---|---|---|---|
| 1.0.0.0 |
