PRINTVEC - Prints a vector into a string Syntax function str=printvec(vv,maxLength) Reference "On the extension of trace norm to tensors" Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima arXiv:1010.0789 http://arxiv.org/abs/1010.0789 Copyright(c) 2010 Ryota Tomioka This software is distributed under the MIT license. See license.txt
0001 % PRINTVEC - Prints a vector into a string 0002 % 0003 % Syntax 0004 % function str=printvec(vv,maxLength) 0005 % 0006 % Reference 0007 % "On the extension of trace norm to tensors" 0008 % Ryota Tomioka, Kohei Hayashi, and Hisashi Kashima 0009 % arXiv:1010.0789 0010 % http://arxiv.org/abs/1010.0789 0011 % 0012 % Copyright(c) 2010 Ryota Tomioka 0013 % This software is distributed under the MIT license. See license.txt 0014 0015 0016 function str=printvec(vv,ml) 0017 0018 if ~exist('ml','var') 0019 ml=10; 0020 end 0021 0022 0023 vv=vv(:); 0024 0025 str = '['; 0026 0027 for ii=1:min(length(vv),ml)-1 0028 str = [str, sprintf('%g ', vv(ii))]; 0029 end 0030 0031 if length(vv)>ml 0032 str = [str, '...']; 0033 end 0034 0035 str = [str, sprintf('%g]',vv(end))];