a=serad([9 -4 0])
vys =
-4 0 9
Kontrola pomoci disp: -4 0 9
Kontrola pomoci fprintf: -4 0 9
Kontrola pomoci fprintf: -4 0 9
Kontrola pomoci sort
s =
-4 0 9
a =
-4 0 9
k=setrid([3 6 7],1)
vys =
3 6 7
Kontrola pomoci disp: 3 6 7
Kontrola pomoci fprintf: 3 6 7
Kontrola pomoci fprintf: 3 6 7
Kontrola pomoci sort
s =
3 6 7
k =
3 6 7
k=setrid([3 6 7],2)
vys =
3 6 7
Kontrola pomoci disp: 3 6 7
Kontrola pomoci fprintf: 3 6 7
Kontrola pomoci fprintf: 3 6 7
Kontrola pomoci sort
s =
3 6 7
k =
7 6 3
k=setrid([3 63 7],1)
vys =
3 7 63
Kontrola pomoci disp: 3 7 63
Kontrola pomoci fprintf: 3 7 63
Kontrola pomoci fprintf: 3 7 63
Kontrola pomoci sort
s =
3 7 63
k =
3 7 63
k=setrid([3 63 7],3)
vys =
3 7 63
Kontrola pomoci disp: 3 7 63
Kontrola pomoci fprintf: 3 7 63
Kontrola pomoci fprintf: 3 7 63
Kontrola pomoci sort
s =
3 7 63
k =
3 7 63
k=setrid([3 63 -7],0)
vys =
-7 3 63
Kontrola pomoci disp: -7 3 63
Kontrola pomoci fprintf: -7 3 63
Kontrola pomoci fprintf: -7 3 63
Kontrola pomoci sort
s =
-7 3 63
k =
-7 3 63
help for
for Repeat statements a specific number of times.
The general form of a for statement is:
for variable = expr, statement, ..., statement END
The columns of the expression are stored one at a time in
the variable and then the following statements, up to the
END, are executed. The expression is often of the form X:Y,
in which case its columns are simply scalars. Some examples
(assume N has already been assigned a value).
for R = 1:N
for C = 1:N
A(R,C) = 1/(R+C-1);
end
end
Step S with increments of -0.1
for S = 1.0: -0.1: 0.0, do_some_task(S), end
Set E to the unit N-vectors
for E = eye(N), do_some_task(E), end
Long loops are more memory efficient when the colon expression appears
in the for statement since the index vector is never created.
The BREAK statement can be used to terminate the loop prematurely.
See also parfor, if, while, switch, break, continue, end, colon.
Reference page in Help browser
doc for
for i=[5 4 1]
i
end
i =
5
i =
4
i =
1
for j=[1 2;9 7;10 2]
j
end
j =
1
9
10
j =
2
7
2
s=soucvektor(1:9)
Soucetr prvku= 45
Sum= 45
s =
45
clc
s=soucvektor(1:9)
Soucetr prvku= 45
Sum= 45
s =
45
s=soucvektor([0 0])
Soucet prvku= 0
Sum= 0
s =
0
help while
while Repeat statements an indefinite number of times.
The general form of a while statement is:
while expression
statements
END
The statements are executed while the real part of the expression
has all non-zero elements. The expression is usually the result of
expr rop expr where rop is ==, <, >, <=, >=, or ~=.
The BREAK statement can be used to terminate the loop prematurely.
For example (assuming A already defined):
E = 0*A; F = E + eye(size(E)); N = 1;
while norm(E+F-E,1) > 0,
E = E + F;
F = A*F/N;
N = N + 1;
end
See also for, if, switch, break, continue, end.
Reference page in Help browser
doc while
s=soucvektor(1:9)
Soucet prvku= 45
Sum= 45
Soucet prvku pomoci while= 45
s =
45
diary off