source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/extras/@lmi/replace.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 773 bytes
Line 
1function F = replace(F,X,W)
2%REPLACE        Substitutes variables in a SET object
3%
4%Z = REPLACE(F,X,W)  Replaces any occurence of the SDPVAR object Y
5%                    in the SDPVAR object X with the double W
6%
7% Example
8%  x = sdpvar(1,1);
9%  t = sdpvar(1,1);
10%  F = set([1+t;1+x+t] > 0);
11%  F = replace(F,x,2) generates F=set([1+t;3+t] > 0)
12
13if prod(size(W)) == 1
14    W = repmat(W,size(X));
15end
16
17keep = [];
18
19for i = 1:length(F.clauses)
20    F.clauses{i}.data = replace(F.clauses{i}.data,X,W);
21    if isempty(F.clauses{i}.data) | isa(F.clauses{i}.data,'double')
22        keep(i)=0;
23    else
24        keep(i)=1;
25    end
26end
27
28F.clauses = {F.clauses{find(keep)}};
29
30% Get new identifiers
31F.LMIid = [];
32for i = 1:length(F.clauses)
33    F.LMIid = [F.LMIid yalmip('lmiid')];
34end
Note: See TracBrowser for help on using the repository browser.