stdout_snn.m

来自「神经网络的工具箱, 神经网络的工具箱,」· M 代码 · 共 51 行

M
51
字号
function count = stdout_snn(varargin)%STDOUT_SNN Print to GUI stdout.h = findobj('Tag', 'stdout');if h    fig = get(h(1), 'Parent');   stdout_struct = getfield(get(fig, 'UserData'), 'stdout');   new_text = str2lines(sprintf(varargin{:}));   text =  stdout_struct.string;    L = size(text,1);    text{L} = strcat(text{L}, new_text{1});   nl = size(new_text, 1);   if (nl>1)       text = [text; new_text(2:nl)];   end   auf(fig, 'stdout.string', text);   set(h, 'String', text);   set(h, 'ListboxTop', size(text,1));   if (nargout == 1)      count = size(new_text, 2);   end   drawnow;else   count = fprintf(varargin{:});end%==================================================================function c = str2lines(s)L = size(s,2);nl = find(s == sprintf('\n'));ind = min(nl);if (isempty(ind))   c(1) = {s};else   if (ind == 1)      c(1) = {''};   else      c(1) = {s(1:ind-1)};   end   if (ind<L)      c_rest = str2lines(s(ind+1:L));      c = [c; c_rest];   else      c = [c; {''}];   endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?