Last change
on this file since 4 was
4,
checked in by zhangj, 10 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
769 bytes
|
Line | |
---|
1 | function sp=horzcat(varargin) |
---|
2 | % sympoly/horzcat: vertical concatenation for sympoly objects and scalars |
---|
3 | % usage: sp=[sp1;sp2;sp3;...]; |
---|
4 | % |
---|
5 | % arguments: |
---|
6 | % sp,sp1,sp2, ... - sympoly objects or scalars or arrays |
---|
7 | |
---|
8 | n=length(varargin); |
---|
9 | |
---|
10 | sp=varargin{1}; |
---|
11 | if ~isa(sp,'sympoly') |
---|
12 | sp=sympoly(sp); |
---|
13 | end |
---|
14 | [r1,c1] = size(sp); |
---|
15 | |
---|
16 | % first check the sizes |
---|
17 | R = sum(cellfun('size',varargin,1)); |
---|
18 | |
---|
19 | % expand sp up to the correct final size |
---|
20 | if R>r1 |
---|
21 | sp(R,c1) = sp(1); |
---|
22 | end |
---|
23 | |
---|
24 | for k=2:n |
---|
25 | spk=varargin{k}; |
---|
26 | [rk,ck]=size(spk); |
---|
27 | |
---|
28 | % check for row comformance |
---|
29 | if c1~=ck |
---|
30 | error 'Objects do not conform for vertical concatenation' |
---|
31 | end |
---|
32 | |
---|
33 | if ~isa(spk,'sympoly') |
---|
34 | spk=sympoly(spk); |
---|
35 | end |
---|
36 | |
---|
37 | for i=1:rk |
---|
38 | for j=1:ck |
---|
39 | sp(i+r1,j)=spk(i,j); |
---|
40 | end |
---|
41 | end |
---|
42 | |
---|
43 | r1 = r1 + rk; |
---|
44 | |
---|
45 | end |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.