Summary of MATLAB Onramp
Summary of MATLAB Onramp
Basic syntax
Example Description
Desktop management
Function Example Description
Array types
Example Description
4 scalar
[3 5] row vector
[3 4 5;6 7 8] matrix
Evenly-spaced vectors
Example Description
1:4 Create a vector from 1 to 4, spaced by 1, using the colon (:) operator.
linspace(1,10,5) Create a vector with 5 elements. The values are evenly spaced from 1 to 10.
Creating matrices
Example Description
A(end,2) Access the element in the second column of the last row.
Array operations
Example Description
Multiple outputs
Example Description
[xrow,xcol] = size(x) Save the number of rows and columns in x to two different variables.
[xMax,idx] = max(x) Calculate the maximum value of x and its corresponding index value.
Documentation
Example Description
doc randi Open the documentation page for the randi function.
Plotting
Example Description
hold off Create a new axes for the next plotted line.
Logicals
Example Description
x(x==999) = 1 Replace all values in x that are equal to 999 with the value 1.
Programming
Example Description