Matlab Flashcards
• MATLAB variable and file name conventions
cant start with a number
cant be the name of a fucntion
cant exceed namelengthmax
or be a keyword
when to use ()
Use parentheses to specify precedence of operations, enclose function input arguments, and index into an array.
also indexing
when to use []
Array construction
Array concatenation
Empty matrix and array element deletion
Multiple output argument assignment
when to use {}
Cell array assignment and contents
Difference between script & function
scripts can be run on their own but functions need to be called
input
x = input(prompt)
output
fprintf(‘Happy Birthday\n’);
fprintf(‘My name is %s\n’, prof_name);
disp(X)
syntax
missing semicolon etc
global workspace
avalable to everything
local workspace
only avalable to the function that it is called in
• What is considered “good practice”?
formatting and commenting
2d plots
plot(X,Y)
indexing arrays
do it 2d like
matrix(Row,Collum)
matrix with integer referencing
matrix(num) num is the number of the array
Array resizing and reshaping
ASK
loading files matlab
load(filename)
Element-wise operators
.* .^ ./
Transposing arrays
array’
Clc
Clear command window
Close
Clear system memory