MATLAB: Difference between revisions

Content deleted Content added
Improve presentation and add internal link
Tags: Visual edit Mobile edit Mobile web edit Advanced mobile edit
Improve presentation and add internal link
Tags: Visual edit Mobile edit Mobile web edit Advanced mobile edit
Line 368:
 
===Variables===
[[Variable (computer science)|Variables]] are defined using the [[Assignment (computer science)|assignment]] operator, <code>=</code>.
Variables are defined using the assignment operator, <code>=</code>. MATLAB is a [[Strong and weak typing|weakly typed]] programming language because types are implicitly converted.<ref>{{cite web|title=Comparing MATLAB with Other OO Languages|url=http://www.mathworks.com/help/matlab/matlab_oop/matlab-vs-other-oo-languages.html|work=MATLAB|publisher=MathWorks|access-date=August 14, 2013}}</ref> It is an inferred typed language because variables can be assigned without declaring their type, except if they are to be treated as symbolic objects,<ref>{{cite web|title=Create Symbolic Variables and Expressions|url=http://www.mathworks.com/help/symbolic/creating-symbolic-variables-and-expressions.html|work=Symbolic Math Toolbox|publisher=MathWorks|access-date=August 14, 2013}}</ref> and that their type can change. Values can come from [[constant (computer science)|constant]]s, from computation involving values of other variables, or from the output of a function. For example:
 
Variables are defined using the assignment operator, <code>=</code>. MATLAB is a [[Strong and weak typing|weakly typed]] programming language because types are implicitly converted.<ref>{{cite web|title=Comparing MATLAB with Other OO Languages|url=http://www.mathworks.com/help/matlab/matlab_oop/matlab-vs-other-oo-languages.html|work=MATLAB|publisher=MathWorks|access-date=August 14, 2013}}</ref> It is an inferred typed language because variables can be assigned without declaring their type, except if they are to be treated as symbolic objects,<ref>{{cite web|title=Create Symbolic Variables and Expressions|url=http://www.mathworks.com/help/symbolic/creating-symbolic-variables-and-expressions.html|work=Symbolic Math Toolbox|publisher=MathWorks|access-date=August 14, 2013}}</ref> and that their type can change. Values can come from [[constant (computer science)|constant]]s, from computation involving values of other variables, or from the output of a function. For example:
<syntaxhighlight lang="matlabsession">
>> x = 17