genpath2

genpath2 calls genpath and removes folders matching a specified pattern
91 descargas
Actualizado 7 Feb 2021

Description
MATLAB's genpath(folderName) creates a character vector containg the path to folderName and any of its subfolders. genpath excludes folders starting with @, +, private, and resource, but it does not allow users to specify other patterns to exclude from its output.

This can cause problems when users addpath using the output of genpath. For one, it becomes more difficult to parse the output of path because many potentially unused folders are now on the file path. And similarly, it can lead to frequent folder handle notifications from MATLAB as it searches through unusued folders for files--especially when using busy network drives.

This is where genpath2 comes in. Inspired by Jesse Hopkins's genpath_exclude, genpath2 is a wrapper for genpath (instead of a standalone function) that executes genpath and then removes folders from its output matching a specified pattern.

Usage
genpath2(folderName) returns a vector identical to genpath(folderName)
genpath2(folderName, '.git') returns a vector without folders starting with .git
genpath2(folderName, {'.git', '.svn'}) returns a vector without folders starting with .git or .svn

Contributing
Original Author: Santiago I. Sordo-Palacios
If you find a bug or would like to add a feature, please open and issue and submit a pull request via the GitHub Project. I do not monitor comments on the MATLAB File Exchange.

Citar como

Santiago Sordo-Palacios (2024). genpath2 (https://github.com/ssordopalacios/matlab-genpath2), GitHub. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2019a
Compatible con cualquier versión desde R2016b hasta R2019a
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Search Path en Help Center y MATLAB Answers.
Etiquetas Añadir etiquetas
Agradecimientos

Inspirado por: genpath_exclude

Community Treasure Hunt

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

Start Hunting!

No se pueden descargar versiones que utilicen la rama predeterminada de GitHub

Versión Publicado Notas de la versión
1.0.0

Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.
Para consultar o notificar algún problema sobre este complemento de GitHub, visite el repositorio de GitHub.