1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) INRIA - Serge Steer
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function s=%lss_i_s(i,j,s1,s2)
14    //%lss_i_s(i,j,s1,s2) <=> s2(i,j)=s1
15
16    [lhs,rhs]=argn(0)
17
18    if rhs==3 then
19        s2=s1;s1=j;
20        if (type(i)==10|type(i)==15) then //cell or struct case
21            s=createstruct(i,s1)
22            if type(i(1))<>10 & i(2)=="entries" then
23                // change struct to cell
24                f=getfield(1,s);f(1)="ce"
25                s=setfield(1,f,s)
26            end
27            return
28        end
29        [a1,b1,c1,d1,x1,dom1]=s1(2:7)
30        d2=s2;
31        [n1,n1]=size(a1);
32        if size(d2,2)>1 then
33            b2=zeros(1,size(d2,2))
34            b2(i)=b1
35            c2=c1
36        elseif size(d2,1)>1 then
37            c2=zeros(size(d2,1),1)
38            c2(i)=c1
39            b2=b1
40        else
41            error(msprintf(_("%s: Invalid syntax for a MIMO system.\n"),"%lss_i_s"));
42        end
43        d2(i)=d1;
44        s=lsslist(a1,b2,c2,d2,x1,dom1)
45    else
46        [a1,b1,c1,d1,x1,dom1]=s1(2:7)
47        d2=s2;
48        [n1,n1]=size(a1);
49        b2(1:n1,j)=b1
50        c2(i,1:n1)=c1
51        d2(i,j)=d1;
52        s=lsslist(a1,b2,c2,d2,x1,dom1)
53    end
54endfunction
55