Grocer Function
NAME
com_size - replaces values of matrix x
CALLING SEQUENCE
[ret,x,aout,bout]=com_size(x,a,b)
PARAMETERS
Input
-
x = a matrix or vector
-
a = a scalar or matrix
-
b = a scalar or matrix
Output
-
ret = an indicator 0 if common_size, 1 if not
-
x = input matrix
-
a = matrix size(x) or input matrix a if already size(x)
-
b = matrix size(x) or input matrix b if already size(x)
DESCRIPTION
Makes a,b scalars equal to constant matrices size(x) or leave them unchanged if they are already of common size
EXAMPLE
1) [r,x,ao,bo]=com_size(ones(4,3),5,2)
2) [r,x,ao,bo]=com_size(ones(2,2),[3,2;1,0],[2,4;5,3])
3) [r,x,ao,bo]=com_size(ones(2,2),[3,2],[2,4;5,3])
Example 1 returns:
bo =
! 2. 2. 2. !
! 2. 2. 2. !
! 2. 2. 2. !
! 2. 2. 2. !
ao =
! 5. 5. 5. !
! 5. 5. 5. !
! 5. 5. 5. !
! 5. 5. 5. !
x =
! 1. 1. 1. !
! 1. 1. 1. !
! 1. 1. 1. !
! 1. 1. 1. !
r =
0.
Example 2 returns:
bo =
! 2. 2. 2. !
! 2. 2. 2. !
! 2. 2. 2. !
! 2. 2. 2. !
ao =
! 5. 5. 5. !
! 5. 5. 5. !
! 5. 5. 5. !
! 5. 5. 5. !
x =
! 1. 1. 1. !
! 1. 1. 1. !
! 1. 1. 1. !
! 1. 1. 1. !
r =
0.
Example 3 returns:
bo =
! 2. 4. !
! 5. 3. !
ao =
! 3. 2. !
x =
! 1. 1. !
! 1. 1. !
r =
1.
AUTHOR
Eric Dubois 2002