matlab week 2.1 Flashcards
what should you do to matrices to properly store data?
transpose
: operator in indexing (i.e (2, :))
serves as ‘select all’ and allows you to select specific rows or columns
to a computer everything is ____
numbers.
ASCII
system that stores letters and special characters as number for computer
uint(‘a’)
returns ASCII number, in this case 97
char( 97 )
returns character that ASCII number represents, in this case a
num2str()
converts numbers to string with ASCII represented characters
str2num()
converts string to ASCII number representation
adding a number to a string…
just concatenates with ASCII rep of number, doesn’t do what you want
dimensions of array being concatenated must be…
the same
multidimensional matrix
third layer that allows multiple ‘pages’ in a book of code
find(x)
if you have an array x
locates all nonzero elements of array x and outputes the corresponding indices in x
find (X, k, ‘first’)
returns the first k indices corresponding to nonzero elements of the array
-> you can do the same with ‘last’ and it will return first k indices from the back
[row, column] = find(B)
finds indies of multidimensional matrix B that are nonzero and stores corresponding row numbers in variable row and column number in variable column
you can add optional ‘v’ to the outputs and that will return what the nonzero numbers are
what if X is a logical expression?
[row, col, v] = find( A == 9)
vector v is then logical and will contain the nonzero elements of logical array obtained by evaluating X