- , . , . 4 - hms , , , .
4. , .
function [hour, minute, second] = hms(sec)
hour = floor(sec/3600);
minute = floor((sec - hour*3600)/60);
second = sec - hour*3600 - minute*60;
- :
>> [H, M, S]=hms(10000)
H =
M =
S =
, . . function myfun(a,b) function [ ] = myfun(a,b), - . .
1. - . -.
;
;
.
2. - :
;
;
;
;
.
, , , , , .
for while. for , while , , .
for
for :
for count = start: step: final
MATLAB
end
count , start , final , step , count . , count final. , .
while
while , .
while , :
while
MATLAB
end
while , . , 1.
|
|
1.
== | |
< | |
<= | |
>= | |
~= |
if switch , MATLAB.
if
if , , if-elseif-else .
if
MATLAB
end
, MATLAB, if end, , , end. , .
switch
switch
case 1
MATLAB
case 2
MATLAB
case N
MATLAB
otherwise
MATLAB
end
case, , switch , case, case. - switch, , case, . switch , , otherwise.
switch , . if.