Matlab Commands
>>>load file_name.extension
>>>load('file_name.extension')
>>> who
>>> whos
‘who’ command shows what variables I have in my Matlab workspace.
‘whos’ gives me the detailed view of variables, including ‘Attr names’, ‘size’, ‘bytes’, ‘class’.
Here ‘class’ means ‘double’ or ‘char’ …
format:
>>> save file_name.extension variable_name
such as:
>>> save hello.mat A
or:
>>> save hello.txt A -ascii % Here '-ascii' makes it readable for human
suppose that A is [1 2; 3 4; 5 6;]
then if we want to index (3,2), which is 6, we just need to write:
>>> A(3,2)
and if we want to index the second row of A, which is ‘3 4’, we need to write:
>>> A(2,:) % Here ':' means every element along that row/colomun
Similarily, if we want to index the second column of A, which is ‘2 4 6’, what we need it to write:
>>> A(:,2)
Just write:
>>> A([1 3], :)
>>> A(:,2) = [11; 12; 13]
>>> A = [A, [101; 102; 103]] % Note that here we use ';' rather than ','
>>> A(:)
Suppose that B is equal to [11 12; 13 14; 15 16]
then:
>>> C = [A B] % Concatenating A and B matrices side by side
Now, C is supposed to be [1 2; 3 4; 5 6; 11 12; 13 14; 15 16]
the command above is equal to this:
>>> C = [A, B] % Concatenating A and B matrices side by side
What about this:
>>> C = [A; B] % Concatenating A and B top and bottom
when I typed here, I found that all codes are actually posted in this site. So if there are any questions or doubts, just search for it by looking into this link:
https://www.coursera.org/learn/machine-learning/resources/QQx8l