mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-13 18:24:39 +02:00
Merge pull request #3086 from veghp/master
matlab/en "Conditional statements" and "Method" update
This commit is contained in:
@@ -374,8 +374,8 @@ disp('Hello World') % Print out a string
|
|||||||
fprintf % Print to Command Window with more control
|
fprintf % Print to Command Window with more control
|
||||||
|
|
||||||
% Conditional statements (the parentheses are optional, but good style)
|
% Conditional statements (the parentheses are optional, but good style)
|
||||||
if (a > 15)
|
if (a > 23)
|
||||||
disp('Greater than 15')
|
disp('Greater than 23')
|
||||||
elseif (a == 23)
|
elseif (a == 23)
|
||||||
disp('a is 23')
|
disp('a is 23')
|
||||||
else
|
else
|
||||||
@@ -545,7 +545,7 @@ ans = multiplyLatBy(a,3)
|
|||||||
|
|
||||||
% The method can also be called using dot notation. In this case, the object
|
% The method can also be called using dot notation. In this case, the object
|
||||||
% does not need to be passed to the method.
|
% does not need to be passed to the method.
|
||||||
ans = a.multiplyLatBy(a,1/3)
|
ans = a.multiplyLatBy(1/3)
|
||||||
|
|
||||||
% Matlab functions can be overloaded to handle objects.
|
% Matlab functions can be overloaded to handle objects.
|
||||||
% In the method above, we have overloaded how Matlab handles
|
% In the method above, we have overloaded how Matlab handles
|
||||||
|
Reference in New Issue
Block a user