Advertisement
cdolphin

Matrix size comparison

Apr 12th, 2011
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.60 KB | None | 0 0
  1. >> aZeros = zeros(200,200);
  2. >> aOnes = ones(200,200);
  3. >> aSparseZeros=sparse(200,200);
  4. >> aSparseOnes =sparse(200,200); %first create sparse matrix
  5. >> aSparseOnes(:,:) = 1; %assign all values to one
  6. >> whos %display memory information for this workspace
  7.   Name                Size              Bytes  Class     Attributes
  8.  
  9.   aOnes             200x200            320000  double              
  10.   aSparseOnes       200x200            320000  double              
  11.   aSparseZeros      200x200               816  double    sparse    
  12.   aZeros            200x200            320000  double              
  13.  
  14. >>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement