Initial commit
[pftoolbox.git] / expressions / @xsymbolic / refresh.m
blob39bec5559505a0b27c3dd37f8559cb880e132e5d
1 function obj=refresh(obj);\r
2 % No documentation available\r
3 \r
4 % Toolbox for nonlinear filtering.\r
5 % Copyright (C) 2005  Jakob Rosén <jakob.rosen@gmail.com>\r
6 %\r
7 % This program is free software; you can redistribute it and/or\r
8 % modify it under the terms of the GNU General Public License\r
9 % as published by the Free Software Foundation; either version 2\r
10 % of the License, or (at your option) any later version.\r
11 %\r
12 % This program is distributed in the hope that it will be useful,\r
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
15 % GNU General Public License for more details.\r
16 %\r
17 % You should have received a copy of the GNU General Public License\r
18 % along with this program; if not, write to the Free Software\r
19 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
21 expression=obj.expression;\r
22 if ~isempty(expression)\r
24         % Calculate the amount of subexpressions\r
25         if isa(expression,'cell')\r
26                 n=length(expression);\r
27         else\r
28                 % A single object was supplied\r
29                 n=1;\r
30                 expression={expression};\r
31         end;\r
33         xvars=obj.xvars;\r
34         uvars=obj.uvars;\r
35         wvars=obj.wvars;\r
37         % Convert all subexpressions to char\r
38         charexpr=convert2char(expression);\r
40         % If *vars is empty, calculate default values.\r
41         if isempty(xvars); xvars=getvars(charexpr,'x'); end;\r
42         if isempty(wvars); wvars=getvars(charexpr,obj.wchar); end;\r
43         if isempty(uvars); uvars=getvars(charexpr,'u'); end;\r
45         % Generate the internal expression, for use with the feval command.\r
46         intexpr=char2oneline(ext2int(charexpr,xvars,'x',wvars,'w',uvars,'u')');\r
48 %       obj.expression=expression;\r
49         obj.intexpr=intexpr;\r
50         obj.str=expr2str(expression);\r
51         obj.exprsize=[n,0];\r
52         obj.xvars=xvars;\r
53         obj.uvars=uvars;\r
54         obj.wvars=wvars;\r
55 end\r