Parameter name-value pair parsing - concise syntax, no assignin, and very fast.
Ahora está siguiendo esta publicación
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Why do we need another parameter parsing solution? MATLAB's inputParser class, while flexible, is relatively slow. Simpler methods are verbose and/or only handle positional arguments. Many FEX parameter parsers use assignin, which is convenient, but also slow and unsafe.
This function combines brevity in usage, high performance, and the convenience and clarity of parameter name-value pairs. It is around 9-20x faster than inputParser, and is one of the fastest parameter parsers on FEX. For up-to-date documentation and bug reports, see GitHub.
Syntax:
parseParameters(Defaults, callerVarargin, varargin)
Optional inputs:
isCaseSensitive (bool): Default false. Determines case sensitivity
expandStruct (bool): Default true. If false, parseParameters returns a struct similar to the Defaults struct.
Within yourFunction(...), specify defaults in a struct:
Defaults.x = 1;
Defaults.y = 5;
Then call
[x,y] = parseParameters(Defaults,varargin);
The user can then call
yourFunction(...,'Y',2,'x',3);
to change x and y.
Note that it is case insensitive by default, and the user's order doesn't matter.
Citar como
Jeffrey Chiou (2026). parseParameters (https://github.com/jeffchiou/parseParameters), GitHub. Recuperado .
Agradecimientos
Inspirado por: loadOptions, ArgUtils
Información general
- Versión 1.3.0.0 (5,44 KB)
-
Ver licencia en GitHub
Compatibilidad con la versión de MATLAB
- Compatible con cualquier versión
Compatibilidad con las plataformas
- Windows
- macOS
- Linux
No se pueden descargar versiones que utilicen la rama predeterminada de GitHub
| Versión | Publicado | Notas de la versión | Action |
|---|---|---|---|
| 1.3.0.0 | Description and summary reformatting/updating. |
