1function disp (A, level) 2%DISP display the contents of a MATLAB or GraphBLAS matrix. 3% disp (A, level) displays the matrix A. The 2nd argument controls how 4% much is printed; 0: none, 1: terse, 2: a few entries, 3: all, 4: a few 5% entries with high precision, 5: all with high precision. The default is 6% 2 if level is not present. To use this function on a MATLAB sparse 7% matrix, use disp (A, GrB (level)). This is useful since disp(A) will 8% always display all entries of A, which can be too verbose if nnz (A) 9% is huge. 10% 11% Example: 12% 13% A = sprand (50, 50, 0.1) ; 14% % just print a few entries 15% disp (A, GrB (2)) 16% G = GrB (A) 17% % print all entries 18% A 19% disp (G, 3) 20% % print all entries in full precision 21% format long 22% A 23% disp (G, 5) 24% 25% See also GrB/display. 26 27% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 28% SPDX-License-Identifier: GPL-3.0-or-later 29 30if (nargin < 2) 31 level = 2 ; 32else 33 level = gb_get_scalar (level) ; 34end 35 36if (level > 0) 37 name = inputname (1) ; 38 if (~isempty (name)) 39 fprintf ('\n%s =\n', name) ; 40 end 41end 42 43if (isobject (A)) 44 A = A.opaque ; 45 gbdisp (A, gb_nnz (A), level) ; 46else 47 gbdisp (A, nnz (A), level) ; 48end 49 50if (level > 0) 51 fprintf ('\n') ; 52end 53 54