Home > matlab > acado > packages > +acado > @Vector > Vector.m

Vector

PURPOSE ^

A vector built from standard Matlab matrix notations

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

A vector built from standard Matlab matrix notations

  Usage:
    >> Vector([]);

  Parameters:
    [] vector


  Example:
    >> f = acado.Vector([1,2,3]);

  Licence:
    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)

    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
    Developed within the Optimization in Engineering Center (OPTEC) under
    supervision of Moritz Diehl. All rights reserved.

    ACADO Toolkit is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 3 of the License, or (at your option) any later version.

    ACADO Toolkit is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with ACADO Toolkit; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

    Author: David Ariens
    Date: 2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 %A vector built from standard Matlab matrix notations
0002 %
0003 %  Usage:
0004 %    >> Vector([]);
0005 %
0006 %  Parameters:
0007 %    [] vector
0008 %
0009 %
0010 %  Example:
0011 %    >> f = acado.Vector([1,2,3]);
0012 %
0013 %  Licence:
0014 %    This file is part of ACADO Toolkit  - (http://www.acadotoolkit.org/)
0015 %
0016 %    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
0017 %    Copyright (C) 2008-2009 by Boris Houska and Hans Joachim Ferreau, K.U.Leuven.
0018 %    Developed within the Optimization in Engineering Center (OPTEC) under
0019 %    supervision of Moritz Diehl. All rights reserved.
0020 %
0021 %    ACADO Toolkit is free software; you can redistribute it and/or
0022 %    modify it under the terms of the GNU Lesser General Public
0023 %    License as published by the Free Software Foundation; either
0024 %    version 3 of the License, or (at your option) any later version.
0025 %
0026 %    ACADO Toolkit is distributed in the hope that it will be useful,
0027 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
0028 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0029 %    Lesser General Public License for more details.
0030 %
0031 %    You should have received a copy of the GNU Lesser General Public
0032 %    License along with ACADO Toolkit; if not, write to the Free Software
0033 %    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0034 %
0035 %    Author: David Ariens
0036 %    Date: 2010
0037 %
0038 classdef Vector < acado.VectorspaceElement    
0039     properties
0040        
0041     end
0042     
0043     methods
0044         function obj = Vector(val)
0045             global ACADO_;
0046 
0047             if (isa(val, 'numeric'))
0048                 ACADO_.count_vector = ACADO_.count_vector+1;
0049                 obj.name = strcat('acadodata_v', num2str(ACADO_.count_vector));
0050                 
0051                 [m n] = size(val);
0052                 
0053                 if (m == 1)
0054                     obj.items = val;
0055                 elseif (n == 1)
0056                     obj.items = val';
0057                 else
0058                     error('Input should be a vector');
0059                 end
0060                 
0061                 ACADO_.helper.addInstruction(obj);
0062                 
0063             elseif (isa(val, 'acado.MexInput'))
0064                 
0065                 if (val.type ~= 2)
0066                     error('MexInput should be in this case a vector, not a scalar or matrix.'); 
0067                 end
0068                 
0069                 obj.mexInput = val;
0070                 obj.name = val.name;
0071                 
0072             else
0073                 error('Vector expects a numeric value or a acado.MexInput'); 
0074              
0075             end     
0076                         
0077         end  
0078         
0079         getInstructions(obj, cppobj, get)
0080 
0081     end
0082     
0083 end

www.acadotoolkit.org/matlab
Generated on Tue 01-Jun-2010 20:14:12 by m2html © 2005