Created
March 25, 2011 18:08
-
-
Save quantombone/887292 to your computer and use it in GitHub Desktop.
Counting in Matlab using sparse
This file contains 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
function count_with_sparse | |
%Find item co-occurences using sparse | |
%Tomasz Malisiewicz | |
item1 = [1 3 1 4 3]; | |
item2 = [2 2 2 1 2]; | |
N = 4; | |
counts = sparse(item1,item2,1,N,N) | |
imagesc(full(counts)) | |
title('Counts using Sparse') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment