Created
March 4, 2015 09:06
-
-
Save shaybensasson/465db066eb6b226cdc8d to your computer and use it in GitHub Desktop.
matrix|array|vector manipulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %acessing and slicing | |
| a=[1 2;3 4] | |
| %{ | |
| a = | |
| 1 2 | |
| 3 4 | |
| %} | |
| %accessing a 2d array using 1d array index | |
| a(1,2) %2 | |
| %% use ':' for don't care values | |
| a(:,2) | |
| %{ | |
| ans = | |
| 2 | |
| 4 | |
| %} | |
| a(1,:) | |
| %{ | |
| ans = | |
| 1 2 | |
| %} | |
| %'end' keyword | |
| a(2:end) | |
| %{ | |
| ans = | |
| 3 2 4 | |
| %} | |
| %% values rotation | |
| i = eye(3); | |
| i = rot90(i) %mirror |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment