ET_PDToolkit/PDToolkit/@PDTrial/display_and_log.m

23 lines
358 B
Matlab

function[obj] = display_and_log(obj, varargin)
if nargin > 2
text = varargin{1};
truncate = varargin{2};
else
if nargin == 2
text = varargin{1};
truncate=0;
end
end
code = 'a+';
if truncate
code = 'w+';
end
display(sprintf(text));
fp = fopen('information.txt',code);
text = [text '\n'];
fprintf(fp, text);
fclose(fp);