DSTV: Datashape & -type Verification
Solves the common problem of massive branching (if-then-elseif-...-end) and repetetive error condition statments by introducing a simple reflective mechanism in programming techniques.
The well known verification functions NARGCHK and NARGOUTCHK return an appropiate error message, if the number of in- resp outputs is not correct.
The ARGCHK function also returns an appropiate error message, but the clue is, the error condition is the message. Therefore any expression evaluatable to a logical condition may be error condition an error message at once.
Brief Example
error(argchk('isnumeric(X)'))
ARGCHK returns the message MSG = '~isnumeric(X)' and ERROR displays MSG and aborts function, if X is not numeric, otherwise ARGCHK returns an empty message MSG = '', so that ERROR takes no action.
As obvious, the power of the function is in the flexibility, to use any kind of expression evaluatable to a logical expression. Due to this any user defined logical function may be used for more understandable error messages.
引用
Ingo Löhken (2024). DSTV: Datashape & -type Verification (https://www.mathworks.com/matlabcentral/fileexchange/8847-dstv-datashape-type-verification), MATLAB Central File Exchange. 取得済み .
MATLAB リリースの互換性
プラットフォームの互換性
Windows macOS Linuxタグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!dstv/
バージョン | 公開済み | リリース ノート | |
---|---|---|---|
1.0.0.0 |
license
|