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.
%assert(testCondition)
% Evaluates the test condition in the caller's context. If the result is
% false, an error is thrown indicating that the test failed.
% TESTCONDITION should be a string.
%
%assert(truthValue)
%assert(truthValue,errMsg)
% If TRUTHVALUE is zero, an error is thrown. The text of the error
% contains ERRMSG if supplied. This version of ASSERT was made to
% promote compatibility with Kevin Murphy's Bayes Net Toolbox (i.e. he
% uses this syntax). TRUTHVALUE must be a logical or a number.
%
%EXAMPLES:
% assert('1==2') ==> assertion error generated
% assert(1==2) ==> assertion error generated (BNT syntax)
% assert 1==2; ==> assertion error generated
% x=1; assert('x==1') ==> no error
% x=1; assert x==1; ==> no error
% assert('{a==3') ==> error generated by Matlab (bad assert code)
Citar como
Gerald Dalley (2026). assert.m (https://es.mathworks.com/matlabcentral/fileexchange/10002-assert-m), MATLAB Central File Exchange. Recuperado .
Agradecimientos
Inspiración para: Assertion function
Información general
- Versión 1.0.0.0 (1,1 KB)
-
Sin licencia
Compatibilidad con la versión de MATLAB
- Compatible con cualquier versión
Compatibilidad con las plataformas
- Windows
- macOS
- Linux
| Versión | Publicado | Notas de la versión | Action |
|---|---|---|---|
| 1.0.0.0 | quick bug fix relative to the last update (which added support for Kevin Murphy's syntax) |
