LOGICALEXPAND
Y = LOGICALEXPAND(X,N) returns a logical vector Y of the same length as the vector X.
For N > 0, series of true entries in X are expanded with N values on either side. For N < 0, series of true entries in X are shrinked with N values on either side. For N = 0, Y equals logical(X).
Examples:
% expand by 1
logicalexpand(logical([0 0 0 1 0 0 0 1 1 0 0 0 1]), 1)
% -> [0 0 1 1 1 0 1 1 1 1 0 1 1]
% shrink with 2
logicalexpand(logical([0 1 1 1 1 1 1 0 0 0 1 1 1 1 1]).', -2)
% -> [0 0 0 1 1 0 0 0 0 0 0 0 1 0 0].'
See also find, logicalfind (File Exchange)
Cita come
Jos (10584) (2024). LOGICALEXPAND (https://www.mathworks.com/matlabcentral/fileexchange/45728-logicalexpand), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.
Versione | Pubblicato | Note della release | |
---|---|---|---|
1.0.0.0 |