Home > NoiseTools > nt_whoss.m

# nt_whoss

## PURPOSE

size=nt_whoss - total Gbytes used by variables

## SYNOPSIS

function varargout=nt_whoss

## DESCRIPTION

    size=nt_whoss - total Gbytes used by variables

      size: number of Gbytes

     If nargout==0, display Gbytes used

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- nt_cca_crossvalidate [AA,BB,RR,iBest]=nt_cca_crossvalidate(xx,yy,shifts,ncomp,A0,B0) - CCA with cross-validation
- nt_cca_crossvalidate2 [A,B,RR]=nt_cca_crossvalidate2(xx,yy,shifts) - CCA with cross-validation
- nt_cluster_jd [IDX,todss,SCORE,COVS]=nt_cluster_jd(x,dsr,smooth,flags,init,verbose) - cluster with joint diagonalization
- nt_dataview [p,data]=nt_dataview(data,p) - view data sets
- nt_idxx nt_idxx(fname,iname,bsize,chunksize,nfft) - create an index file to summarize large data file
- nt_index [status,p]=nt_index(name,p,forceUpdate) - index data files & directories

## SOURCE CODE

    0001 function varargout=nt_whoss
    0002 %size=nt_whoss - total Gbytes used by variables
    0003 %
    0004 %  size: number of Gbytes
    0005 %
    0006 % If nargout==0, display Gbytes used
    0007
    0008 s=evalin('caller', 'whos'); % lists variables in caller's workspace
    0009
    0010 x=cell(1,numel(s));
    0011 [x{:}]=deal(s.bytes);       % transfer to cell array
    0012 size=sum(cat(1,x{:}));      % transfer to array and sum
    0013
    0014 size=size/(2^30);           % bytes --> Gbytes
    0015 nfiles=numel(fopen('all')); % number of open files
    0016
    0017 if nargout == 0
    0018     ST=dbstack;
    0019     if numel(ST)>1;
    0020         disp(['Gbytes used: ', num2str(size), ', open files: ', num2str(nfiles), ...
    0021             ', ', ST(2).file,' line ', num2str(ST(2).line)]);
    0022     else
    0023         disp(['Gbytes used: ', num2str(size), ', open files: ', num2str(nfiles)]);
    0024     end
    0025 else
    0026     varargout{1}=size;
    0027     varargout{2}=nfiles;
    0028 end
    0029