MATLAB: Can I perform logical indexing when the logical indexing matrix is smaller then the indexed matrix in MATLAB 7.0 (R14)

differentindexinglogical?MATLABsize;

The LOGICAL function documentation, accessible by typing the following at the MATLAB prompt:
web([docroot,'/techdoc/ref/logical.html'])
states the following:
A(B), where B is a logical array, returns the values of A at the indices where the real part of B is nonzero. B must be the same size as A.
This implies that if B does not have the same size as matrix A, the logical indexing will return an error. However, if I index matrix A with a logical indexing matrix B whose size is smaller than matrix A as follows:
A = [1 2 3; 4 5 6; 7 8 9];
B = [ 0 1 0; 1 0 1];
A(logical(B))
MATLAB returns the following output instead of returning an error:
ans =
4
7
8

Best Answer

This is an error in the documentation for the LOGICAL function in MATLAB 7.0 (R14). The documentation should read as follows:
When the logical indexing matrix is smaller than the indexed matrix, MATLAB expands the logical indexing matrix with false (or zero) values to be of the same size as the indexed matrix.