>> a=[1,2,3]
a =
1 2 3
>> sort(a)
ans =
1 2 3
>> sum(a)
ans =
6
>> min(a)
ans =
1
>> max(a)
ans =
3
>> b=[6,7,8]
b =
6 7 8
>> a+b
ans =
7 9 11
>> 3*a
ans =
3 6 9
>> cat(1,a,b)
ans =
1 2 3
6 7 8
>> cat(2,a,b)
ans =
1 2 3 6 7 8
>> help cat
cat Concatenate arrays.
cat(DIM,A,B) concatenates the arrays A and B along
the dimension DIM.
cat(2,A,B) is the same as [A,B].
cat(1,A,B) is the same as [A;B].
B = cat(DIM,A1,A2,A3,A4,...) concatenates the input
arrays A1, A2, etc. along the dimension DIM.
When used with comma separated list syntax, cat(DIM,C{:}) or
cat(DIM,C.FIELD) is a convenient way to concatenate a cell or
structure array containing numeric matrices into a single matrix.
Examples:
a = magic(3); b = pascal(3);
c = cat(4,a,b)
produces a 3-by-3-by-1-by-2 result and
s = {a b};
for i=1:length(s),
siz{i} = size(s{i});
end
sizes = cat(1,siz{:})
produces a 2-by-2 array of size vectors.
See also num2cell.
Overloaded methods:
inline/cat
memmapfile/cat
fittype/cat
codistributed/cat
xregpointer/cat
coninputfactor/cat
InputOutputModel/cat
ordinal/cat
nominal/cat
dataset/cat
categorical/cat
sym/cat
Reference page in Help browser
doc cat
>> c=[7,8,9;0,1,2]
c =
7 8 9
0 1 2
>> d=[2,4,6;5,7,9]
d =
2 4 6
5 7 9
>> cat(1,c,d)
ans =
7 8 9
0 1 2
2 4 6
5 7 9
>> cat(2,c,d)
ans =
7 8 9 2 4 6
0 1 2 5 7 9
>> cat(3,c,d)
ans(:,:,1) =
7 8 9
0 1 2
ans(:,:,2) =
2 4 6
5 7 9
>>