From: <par...@us...> - 2010-09-08 23:48:37
|
Revision: 7689 http://octave.svn.sourceforge.net/octave/?rev=7689&view=rev Author: paramaniac Date: 2010-09-08 23:48:31 +0000 (Wed, 08 Sep 2010) Log Message: ----------- control: replace for-loops by cellfun Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/tfdata.m trunk/octave-forge/main/control/inst/@tf/__get__.m trunk/octave-forge/main/control/inst/__conv2tfpolycell__.m Modified: trunk/octave-forge/main/control/inst/@lti/tfdata.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/tfdata.m 2010-09-08 19:44:11 UTC (rev 7688) +++ trunk/octave-forge/main/control/inst/@lti/tfdata.m 2010-09-08 23:48:31 UTC (rev 7689) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -23,7 +23,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: September 2009 -## Version: 0.1 +## Version: 0.2 function [num, den, tsam] = tfdata (sys, rtype = "vector") @@ -38,10 +38,8 @@ tsam = sys.tsam; if (rtype == "vector") - for k = 1 : numel (num) - num(k) = get (num{k}); - den(k) = get (den{k}); - endfor + num = cellfun ("@tfpoly/get", num, "UniformOutput", false); + den = cellfun ("@tfpoly/get", den, "UniformOutput", false); endif endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@tf/__get__.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/__get__.m 2010-09-08 19:44:11 UTC (rev 7688) +++ trunk/octave-forge/main/control/inst/@tf/__get__.m 2010-09-08 23:48:31 UTC (rev 7689) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -20,31 +20,19 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function val = __get__ (sys, prop) switch (prop) # {<internal name>, <user name>} case "num" - val = sys.num; - - for k = 1 : numel (val) - val(k) = get (val{k}); - endfor - + val = cellfun ("@tfpoly/get", sys.num, "UniformOutput", false); case "den" - val = sys.den; - - for k = 1 : numel (val) - val(k) = get (val{k}); - endfor - + val = cellfun ("@tfpoly/get", sys.den, "UniformOutput", false); case {"tfvar", "variable"} val = sys.tfvar; - otherwise error ("get: invalid property name"); - endswitch endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/__conv2tfpolycell__.m =================================================================== --- trunk/octave-forge/main/control/inst/__conv2tfpolycell__.m 2010-09-08 19:44:11 UTC (rev 7688) +++ trunk/octave-forge/main/control/inst/__conv2tfpolycell__.m 2010-09-08 23:48:31 UTC (rev 7689) @@ -1,4 +1,4 @@ -## Copyright (C) 2009 Lukas F. Reichlin +## Copyright (C) 2009 - 2010 Lukas F. Reichlin ## ## This file is part of LTI Syncope. ## @@ -21,7 +21,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: October 2009 -## Version: 0.1 +## Version: 0.2 function ndr = __conv2tfpolycell__ (nd) @@ -29,12 +29,6 @@ nd = {nd}; endif - [ndrows, ndcols] = size (nd); + ndr = cellfun (@tfpoly, nd, "UniformOutput", false); - ndr = cell (ndrows, ndcols); - - for k = 1 : (ndrows*ndcols) - ndr{k} = tfpoly (nd{k}); - endfor - endfunction \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |