genpath2

genpath2 calls genpath and removes folders matching a specified pattern
92 téléchargements
Mise à jour 7 fév. 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.

Citation pour cette source

Santiago Sordo-Palacios (2024). genpath2 (https://github.com/ssordopalacios/matlab-genpath2), GitHub. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2019a
Compatible avec les versions R2016b à R2019a
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Search Path dans Help Center et MATLAB Answers
Remerciements

Inspiré par : genpath_exclude

Community Treasure Hunt

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

Start Hunting!

Les versions qui utilisent la branche GitHub par défaut ne peuvent pas être téléchargées

Version Publié le Notes de version
1.0.0

Pour consulter ou signaler des problèmes liés à ce module complémentaire GitHub, accédez au dépôt GitHub.
Pour consulter ou signaler des problèmes liés à ce module complémentaire GitHub, accédez au dépôt GitHub.