summaryrefslogtreecommitdiff
path: root/nInputData.sci
blob: 8d5a4817aa06c1c470eb4a61e6f45f43e0bb8199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function varargout = nInputSeries(varargin)
// Count the number of input output data series
// 
// Calling Sequence
// ioData = nInputSeries(plantData)
// 
// Parameters
// plantData : iddata type module
// ioData : structure type variable having input and output object
// 
// Description
// plantData must be iddata type. The function returns the number of input and output data series in struct form. It has two fields name as input and output.  
// 
// Examples
// plantData = iddata(rand(100,3),rand(100,2),0.1)
// ioData = nInputSeries(plantData)
// 
// Examples
// plantData = iddata(rand(100,2),[],0.1)
// ioData = nInputSeries(plantData)
// 
// Examples
// plantData = iddata([],rand(100,3),0.1)
// ioData = nInputSeries(plantData)
// 
// Authors
// Ashutosh Kumar Bhargava, Bhushan Manjarekar
// 
    [lhs rhs] = argn(0)
    if rhs <> 1 then
        error(msprintf(gettext("%s: Wrong number of input arguments."),"nInputSeries"))
    end
    iddataData  =  varargin(1)
    if typeof(iddataData) <> 'iddata' then
        error(msprintf(gettext("%s:Wrong type for input argument %d: ""iddata"" expected."),"nInputSeries",1))
    end
    t = struct('input',0,'output',0)
    
    if ~size(iddataData.InputData,'*') then
        t.input = 0
    else
        t.input = size(iddataData.InputData,'c')
    end
    if ~size(iddataData.OutputData,'*') then
        t.output = 0
    else
        t.output = size(iddataData.InputData,'c')
    end
    varargout(1) = t
endfunction