Skip to content

2. Basic Programming Principles

Arduinerd edited this page May 24, 2018 · 9 revisions

Data Types

An important thing to note is that you do not need to implicitly declare a type like other languages. MatLab will automatically assign a type based upon the value assigned.

>> x=2;
>> whos x

The whos "variable" command will output the variable name, size, memory, class, and attributes. It is important to note that data types are not static and will change if the value assigned is of a different type.

Numbers

All numeric values are automatically stored as doubles otherwise known

Constants

Inf (Infinity) - an example of this would be trying to divide by zero NaN (Not a Number) - an example of this would be 0/0 or inf/inf i and j represent the complex constants

Strings

Structure

Cell Arrays

Arrays/Matrices

Operators

Control Statements

Conditionals

Loops

Variables

Clone this wiki locally