MATLAB Examples

check_matrix

Test for the good size of a matrix containing floats

Contents

Description

errmsg = check_matrix(Parameter,PropValue,Dims) tests if the PropValue value is a matrix of floats with the size specified by Dims. It returns his result in errmsg. If the test is passed successfully, the string errmsg is empty. If the test is failed, the string errmsg specifies the error. This message includes the name Parameter.

Input parameters

Parameter: name (string) of the parameter tested.

PropValue: value to test.

Dims: vector specifying the allowed size (dimensions) of the value given. A NaN may be specified to the elements where the size is not constrained.

Output parameters

errmsg: Error message. It is an empty string when the test is successful.

Examples

errmsg = check_matrix('Dim_cavity',[-.5 .5 0 1],[1 4]);
disp(errmsg)
errmsg = check_matrix('Pts_coord',[.2 .3 0;.5 .6 .1;1 1 2;-1 2.1 -2],[NaN 3]);
disp(errmsg)
errmsg = check_matrix('Pts_coord',rand(5,3,2),[NaN 3]);
disp(errmsg)
The parameter "Pts_coord" must have 2 dimensions.

See also

size

Copyright 2013 Mathieu Gendron