-5*(3+8/(7-5)) ans = -35 x=5*(15-89) x = -370 A=[1,2,3;0.5,7,8] A = 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 who Your variables are: A ans x whos Name Size Bytes Class Attributes A 2x3 48 double ans 1x1 8 double x 1x1 8 double pi ans = 3.1416 1+pi ans = 4.1416 sin(pi/2) ans = 1 cos(pi) ans = -1 5/0 ans = Inf 1/0 ans = Inf 80/Inf ans = 0 0/0 ans = NaN sin(pi) ans = 1.2246e-016 eps ans = 2.2204e-016 realmin ans = 2.2251e-308 realmax ans = 1.7977e+308 realmax/2 ans = 8.9885e+307 sqrt(-1) ans = 0 + 1.0000i i ans = 0 + 1.0000i j ans = 0 + 1.0000i 5*i+6-3*i+8-5*j ans = 14.0000 - 3.0000i 5i+2i-9 ans = -9.0000 + 7.0000i 5j ans = 0 + 5.0000i whos Name Size Bytes Class Attributes A 2x3 48 double ans 1x1 16 double complex x 1x1 8 double B=[1+2i,3-4j,5-6i;0,-5,0.5] B = 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 0 -5.0000 0.5000 A A = 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 C=[A;B] C = 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 0 -5.0000 0.5000 whos Name Size Bytes Class Attributes A 2x3 48 double B 2x3 96 double complex C 4x3 192 double complex ans 1x1 16 double complex x 1x1 8 double % komentar 5+6 % scitani ans = 11 f=[1,2,3] f = 1 2 3 g=[5;6;7;8;9] g = 5 6 7 8 9 C C = 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 0 -5.0000 0.5000 D=[C;f] D = 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 0 -5.0000 0.5000 1.0000 2.0000 3.0000 g g = 5 6 7 8 9 H=[D,g] H = Columns 1 through 3 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 0 -5.0000 0.5000 1.0000 2.0000 3.0000 Column 4 5.0000 6.0000 7.0000 8.0000 9.0000 H=[D,g] H = Columns 1 through 3 1.0000 2.0000 3.0000 0.5000 7.0000 8.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 0 -5.0000 0.5000 1.0000 2.0000 3.0000 Column 4 5.0000 6.0000 7.0000 8.0000 9.0000 H=[D,g] H = 1.0000 2.0000 3.0000 5.0000 0.5000 7.0000 8.0000 6.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 7.0000 0 -5.0000 0.5000 8.0000 1.0000 2.0000 3.0000 9.0000 R1=10 R1 = 10 R2=5 R2 = 5 R3=1 R3 = 1 R=R1+R2+R3 R = 16 Odp=[10,5,1] Odp = 10 5 1 R=sum(Odp) R = 16 R=sum([10,5,1]) R = 16 whos Name Size Bytes Class Attributes A 2x3 48 double B 2x3 96 double complex C 4x3 192 double complex D 5x3 240 double complex H 5x4 320 double complex Odp 1x3 24 double R 1x1 8 double R1 1x1 8 double R2 1x1 8 double R3 1x1 8 double ans 1x1 8 double f 1x3 24 double g 5x1 40 double x 1x1 8 double H H = 1.0000 2.0000 3.0000 5.0000 0.5000 7.0000 8.0000 6.0000 1.0000 + 2.0000i 3.0000 - 4.0000i 5.0000 - 6.0000i 7.0000 0 -5.0000 0.5000 8.0000 1.0000 2.0000 3.0000 9.0000 H(2,2) ans = 7 H(4,5) {??? Index exceeds matrix dimensions. } H(4,4) ans = 8 size(H) ans = 5 4 whos Name Size Bytes Class Attributes A 2x3 48 double B 2x3 96 double complex C 4x3 192 double complex D 5x3 240 double complex H 5x4 320 double complex Odp 1x3 24 double R 1x1 8 double R1 1x1 8 double R2 1x1 8 double R3 1x1 8 double ans 1x2 16 double f 1x3 24 double g 5x1 40 double x 1x1 8 double v=size(H) v = 5 4 [r,s]=size(H) r = 5 s = 4 help size SIZE Size of array. D = SIZE(X), for M-by-N matrix X, returns the two-element row vector D = [M,N] containing the number of rows and columns in the matrix. For N-D arrays, SIZE(X) returns a 1-by-N vector of dimension lengths. Trailing singleton dimensions are ignored. [M,N] = SIZE(X) for matrix X, returns the number of rows and columns in X as separate output variables. [M1,M2,M3,...,MN] = SIZE(X) for N>1 returns the sizes of the first N dimensions of the array X. If the number of output arguments N does not equal NDIMS(X), then for: N > NDIMS(X), SIZE returns ones in the "extra" variables, i.e., outputs NDIMS(X)+1 through N. N < NDIMS(X), MN contains the product of the sizes of dimensions N through NDIMS(X). M = SIZE(X,DIM) returns the length of the dimension specified by the scalar DIM. For example, SIZE(X,1) returns the number of rows. If DIM > NDIMS(X), M will be 1. When SIZE is applied to a Java array, the number of rows returned is the length of the Java array and the number of columns is always 1. When SIZE is applied to a Java array of arrays, the result describes only the top level array in the array of arrays. Example: If X = rand(2,3,4); then d = size(X) returns d = [2 3 4] [m1,m2,m3,m4] = size(X) returns m1 = 2, m2 = 3, m3 = 4, m4 = 1 [m,n] = size(X) returns m = 2, n = 12 m2 = size(X,2) returns m2 = 3 See also length, ndims, numel. Overloaded methods: TriRep/size timer/size serial/size tscollection/size gf/size InputOutputModel/size daqdevice/size daqchild/size distributed/size codistributed/size Composite/size fints/size idmodel/size idfrd/size iddata/size idnlmodel/size idnlgrey/size idnlfun/size videosource/size videoinput/size dataset/size categorical/size sym/size Reference page in Help browser doc size K=[1 2 3 4;4 5 6 7] K = 1 2 3 4 4 5 6 7 K(2,1) ans = 4 K(2,1)=0.5 K = 1.0000 2.0000 3.0000 4.0000 0.5000 5.0000 6.0000 7.0000 K(1,4)=-10 K = 1.0000 2.0000 3.0000 -10.0000 0.5000 5.0000 6.0000 7.0000 m=[1:8] m = 1 2 3 4 5 6 7 8 n=1:2:8 n = 1 3 5 7 50:16:100 ans = 50 66 82 98 10:1 ans = Empty matrix: 1-by-0 10:-1:1 ans = 10 9 8 7 6 5 4 3 2 1 10:-0.5:6 ans = Columns 1 through 6 10.0000 9.5000 9.0000 8.5000 8.0000 7.5000 Columns 7 through 9 7.0000 6.5000 6.0000 diary off