Упражнение 3. Matlab: Difference between revisions

From Ilianko
No edit summary
Line 45: Line 45:
=== for ===
=== for ===
  for index = nachalo:stypka:kraj % ako nqma stypka tq e 1
  for index = nachalo:stypka:kraj % ako nqma stypka tq e 1
  statement
end
for i = A % A e vektor/matrica
   statement
   statement
  end
  end


[[Category:Matlab]]
[[Category:Matlab]]

Revision as of 11:31, 15 April 2011

Управляващи оператори

if

if <expression>
  statment
end

if <expression>
 statement;
else
 statement;
end

if <expression>
 statement;
elseif
 statement;
else
 statement;
end

Релации и логически оператори

< , <= , >, >= , ~=, ==

&, &&, |, ||, ~

Логическо равенство да не се ползва за числа с плаваща запетая


switch

switch expression
 case val1
   statement
 case {val2, val3
   statement
 otherwise
   statement
end

Логическо равенство да не се ползва за числа с плаваща запетая

for

for index = nachalo:stypka:kraj % ako nqma stypka tq e 1
  statement
end
for i = A % A e vektor/matrica
  statement
end