Mercurial > forge
changeset 11117:295a5b2520ac octave-forge
control: overloaded size_equal for LTI class
author | paramaniac |
---|---|
date | Thu, 18 Oct 2012 16:15:01 +0000 |
parents | 4494b8997bf3 |
children | ef6fa73519ab |
files | main/control/inst/@lti/size_equal.m |
diffstat | 1 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main/control/inst/@lti/size_equal.m Thu Oct 18 16:15:01 2012 +0000 @@ -0,0 +1,38 @@ +## Copyright (C) 2012 Lukas F. Reichlin +## +## This file is part of LTI Syncope. +## +## LTI Syncope is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## LTI Syncope 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## @deftypefn {Function File} {@var{bool} =} size_equal (@var{a}, @var{b}, @dots{}) +## Return true if LTI models (and matrices) @var{a}, @var{b}, @dots{} +## are of equal size. +## @end deftypefn + +## Author: Lukas Reichlin <lukas.reichlin@gmail.com> +## Created: October 2012 +## Version: 0.1 + +function bool = size_equal (varargin) + + s = cellfun (@size, varargin, "uniformoutput", false); + + if (numel (s) == 1 || isequal (s{:})) # isequal errors out with only 1 argument, numel(s)==0 handled by built-in size_equal + bool = true; + else + bool = false; + endif + +endfunction