%% Create Optimization Expressions by Index and Array Operations
% Create an optimization expression by transposing an optimization variable.

x = optimvar('x',3,2);
y = x'

% Simply indexing into an optimization array does not create an expression, but instead creates an optimization variable that references the original variable. To see this, create a variable w that is the first and third row of x. Note that w is an optimization variable, not an optimization expression.

w = x([1,3],:)

% Create an optimization expression by concatenating optimization variables.

y = optimvar('y',4,3);
z = optimvar('z',4,7);
f = [y,z]

%
% Copyright 2012 The MathWorks, Inc.