disp.m 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
function disp(this)
% get a nice dimensions string

% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved. 
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. 
% </ITA-Toolbox>


if ita_preferences('nakedClasses')
    builtin('disp',this)
else
13 14 15 16 17
    if numel(this) > 1
        disp(['size(' inputname(1) ') = [' num2str(size(this))  ']; (for full display, pick a single instance)']);
        return;
    end

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    disp(['      domain        = ' this.domain '     (nBins = ' num2str(this.nBins) ', nSamples = ' num2str(this.nSamples) ', dimensions = ' num2str(this.dimensions) ') '])
    comment = this.comment;
    nMax = 36;
    if length(comment) > nMax
        comment = [comment(1:round((nMax-3)/2)) '...' comment(end-round((nMax-3)/2):end)];
    end
    string = ['      comment       = ''' comment ''''];
    
    % this block adds the class name
    classnamestring = ['^--|' mfilename('class') '|'];
    fullline = repmat(' ',1,this.LINE_LENGTH);
    fullline(1:numel(string)) = string;
    startvalue = length(classnamestring);
    fullline(length(fullline)-startvalue+1:end) = classnamestring;
    disp(fullline);
end
end