https://github.com/apjanke/octave-validatinator
Validation functions for GNU Octave
https://github.com/apjanke/octave-validatinator
gnu-octave octave
Last synced: 3 months ago
JSON representation
Validation functions for GNU Octave
- Host: GitHub
- URL: https://github.com/apjanke/octave-validatinator
- Owner: apjanke
- License: gpl-3.0
- Created: 2019-03-26T04:54:50.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2022-09-11T22:09:02.000Z (over 2 years ago)
- Last Synced: 2025-02-14T10:51:24.070Z (3 months ago)
- Topics: gnu-octave, octave
- Language: Makefile
- Homepage:
- Size: 34.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: COPYING
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Validatinator for GNU Octave
============================Validation functions for GNU Octave.
In Matlab R2017a, Matlab introduced [Validation Functions](https://www.mathworks.com/help/matlab/matlab_oop/property-validator-functions.html) that allow you concisely express constraints for the types and values of variable and property values.
Octave doesn’t have those yet.
This project provides implementations of them, both some Matlab-compatible ones, and some Octave-specific extensions.## Installation and usage
Validatinator is a standard Octave `pkg` package. Install it using `pkg`.
To install the latest Validatinator for usage or testing:
```
pkg install https://github.com/apjanke/octave-validatinator/archive/master.zip`
pkg load validatinator
```To hack on Validatinator itself, clone the repo and add its `inst/` dir to your Octave path:
```
git clone https://github.com/apjanke/octave-validatinator
``````
addpath /path/to/my/cloned/octave-validatinator/inst
```## Functions
Validatinator provides the following functions:
Matlab compatibility functions (in `Mcode/compat`):
* mustBeFinite(x)
* mustBeInteger(x)
* mustBeMember(x, valid)
* mustBeNonempty(x)
* mustBeNumeric(x)
* mustBeReal(x)New functions (in `Mcode/extend`):
* makeItBeA(x, type)
* mustBeA(x, type)
* mustBeCellstr(x)
* mustBeCharvec(x)
* mustBeSameSize(a, b)
* mustBeScalar(x)
* mustBeScalarLogical(x)
* mustBeVector(x)
* size2str(sz)None of these functions actually do much work, but they are a concise, standardized way of expressing constraints on function input arguments, object properties, and other invariants.
Sprinkle calls to them throughout your code.## Project
The home page for Validatinator for Octave is the [Validatinator GitHub repo](https://github.com/apjanke/octave-validatinator).
For support, feel free to post a bug report or question on the [Validatinator GitHub issue tracker](https://github.com/apjanke/octave-validatinator/issues).
The project author is [Andrew Janke](https://apjanke.net).