# allvariables

Tags:

Updated:

allvariables creates a vector with variables used in a set of objects

## Syntax

y = allvariables(A,B,...)


## Examples

Create a set of constraints and an objective, and then create an new objective function which adds a penalty on all involved variables

% My original model
x = sdpvar(3,1);y = sdpvar(1);
Model = [-1 <= x <=1, y == sum(x)];
Obj = sum(x) + y^2;

% No, I want to solve with a regularization on all variables
Obj = Obj + 0.01*norm(allvariables(Model,Obj))


x1 = depends(A);x2 = depends(B);