depends
depends returns the internal indicies to all linear variables used in an sdpvar expression or constraint object.
Syntax
k = depends(x)
Examples
sdpvar variables are built-up from internal variable indicies (i.e., the only internal name and reference is an integer).
yalmip('clear')
x = sdpvar(1);
getvariables(x)
ans =
1
y = sdpvar(2,3);
getvariables(y)
ans =
2 3 4 5 6 7
For linear expressions, exactly the same result is returned with depends.
depends(x)
ans =
1
depends(y)
ans =
2 3 4 5 6 7
For nonlinear expressions the two commands differ. While getvariables returns the internal index to the nonlinear term, depends returns the index to involved linear variables.
z = x^2;
getvariables(z)
ans =
8
depends(z)
ans =
1
z = x + 3*x^2+y^2;
getvariables(z)
ans =
1 8 9
depends(z)
ans =
1 2