LOGICALEXPAND

expand (or shrink) series in a logical vector (v2.0, feb 2014)
262 download
Aggiornato 3 mar 2014

Visualizza la licenza

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
Creato con R2011a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0