From: <par...@us...> - 2010-10-04 07:05:54
|
Revision: 7799 http://octave.svn.sourceforge.net/octave/?rev=7799&view=rev Author: paramaniac Date: 2010-10-04 07:05:48 +0000 (Mon, 04 Oct 2010) Log Message: ----------- control: simplify display routines Modified Paths: -------------- trunk/octave-forge/main/control/inst/@lti/display.m trunk/octave-forge/main/control/inst/@ss/display.m trunk/octave-forge/main/control/inst/@tf/display.m Added Paths: ----------- trunk/octave-forge/main/control/inst/__labels__.m Removed Paths: ------------- trunk/octave-forge/main/control/inst/__mark_empty_names__.m Modified: trunk/octave-forge/main/control/inst/@lti/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@lti/display.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/@lti/display.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -24,10 +24,8 @@ function display (ltisys) - tsam = ltisys.tsam; - - if (tsam > 0) - disp (sprintf("Sampling time: %g s", tsam)); + if (ltisys.tsam > 0) + disp (sprintf ("Sampling time: %g s", ltisys.tsam)); endif endfunction \ No newline at end of file Modified: trunk/octave-forge/main/control/inst/@ss/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@ss/display.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/@ss/display.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -27,28 +27,10 @@ [inname, outname, tsam] = __lti_data__ (sys.lti); stname = sys.stname; - m = numel (inname); - p = numel (outname); - n = numel (stname); + inname = __labels__ (inname, "u"); + outname = __labels__ (outname, "y"); + stname = __labels__ (stname, "x"); - if (m == 0 || isequal ("", inname{:})) - inname = strseq ("u", 1:m); - else - inname = __mark_empty_names__ (inname); - endif - - if (p == 0 || isequal ("", outname{:})) - outname = strseq ("y", 1:p); - else - outname = __mark_empty_names__ (outname); - endif - - if (n == 0 || isequal ("", stname{:})) - stname = strseq ("x", 1:n); - else - stname = __mark_empty_names__ (stname); - endif - disp (""); if (! isempty (sys.e)) Modified: trunk/octave-forge/main/control/inst/@tf/display.m =================================================================== --- trunk/octave-forge/main/control/inst/@tf/display.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/@tf/display.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -26,21 +26,9 @@ [inname, outname] = __lti_data__ (sys.lti); - m = numel (inname); - p = numel (outname); + [inname, m] = __labels__ (inname, "u"); + [outname, p] = __labels__ (outname, "y"); - if (m == 0 || isequal ("", inname{:})) - inname = strseq ("u", 1:m); - else - inname = __mark_empty_names__ (inname); - endif - - if (p == 0 || isequal ("", outname{:})) - outname = strseq ("y", 1:p); - else - outname = __mark_empty_names__ (outname); - endif - disp (""); for nu = 1 : m Added: trunk/octave-forge/main/control/inst/__labels__.m =================================================================== --- trunk/octave-forge/main/control/inst/__labels__.m (rev 0) +++ trunk/octave-forge/main/control/inst/__labels__.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -0,0 +1,41 @@ +## Copyright (C) 2009 - 2010 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 this program. If not, see <http://www.gnu.org/licenses/>. + +## -*- texinfo -*- +## Return default labels if cell "name" contains only empty strings. +## If not, check whether individual strings of the cell "name" are +## empty and mark them with "?". Used by display routines. + +## Author: Lukas Reichlin <luk...@gm...> +## Created: October 2009 +## Version: 0.2 + +function [name, n] = __labels__ (name, variable = "x") + + n = numel (name); + + if (n == 0 || isequal ("", name{:})) + name = strseq (variable, 1:n); + else + for k = 1 : n + if (isempty (name{k})) + name{k} = "?"; + endif + endfor + endif + +endfunction \ No newline at end of file Deleted: trunk/octave-forge/main/control/inst/__mark_empty_names__.m =================================================================== --- trunk/octave-forge/main/control/inst/__mark_empty_names__.m 2010-10-03 11:49:15 UTC (rev 7798) +++ trunk/octave-forge/main/control/inst/__mark_empty_names__.m 2010-10-04 07:05:48 UTC (rev 7799) @@ -1,34 +0,0 @@ -## Copyright (C) 2009 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 this program. If not, see <http://www.gnu.org/licenses/>. - -## -*- texinfo -*- -## Check whether a string of the cell "name" is empty and mark them -## with "?". Used by display routines. - -## Author: Lukas Reichlin <luk...@gm...> -## Created: October 2009 -## Version: 0.1 - -function name = __mark_empty_names__ (name) - - for k = 1 : numel (name) - if (isempty (name{k})) - name{k} = "?"; - endif - 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. |