Created
May 6, 2012 21:24
-
-
Save Nimster/2624523 to your computer and use it in GitHub Desktop.
Quick reference to some common Matlab idioms/capabilities - mainly to serve as a reminder for me
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
[I, J] = find(A > 0) % Col-order search | |
[J, I] = find(A' > 0) % Row-order (non-zero) search | |
arrayfun(@(x) length(x.field)>0, some_struct_array) % Apply length to 'field' in each element of a struct array | |
a_struct = struct('field1', value1, 'field2', value2) % Create a struct ("object") | |
list = [list 1] % add element to a vector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment