/usr/share/psychtoolbox-3/PsychMatlabTests/fprintfBug.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | function fprintfBug
% Mathworks Case ID: 201530, reported 3/19/99
%
% FPRINTF may interpret the first argument as a filename.
%
% Dear Denis,
%
% I am responding to your e-mails of March 19, concerning FPRINTF.
%
% > in my first message (below) i noted that
% >
% > >fprintf('"%s" hit at time %.3f s\n','5%',1)
% > >
% > >produces no output at all.
% >
% > I now discover that FPRINTF created a file called '"%s" hit
% > at time %.3f s\n' on my disk, and stored a '5' in it each
% > time i executed that statement. Treating the first argument
% > of FPRINTF as a file NAME is undocumented, and not what I
% > expected.
% >
% > Can you clarify what Matlab is doing?
%
% Yes, this behavior is due to a bug in the FPRINTF command. For some
% reason, passing more than two arguments to FPRINTF can cause the first
% argument to be treated as the filename or file ID. This has been reported
% to our development staff to be addressed in a future version of Matlab.
%
% As a workaround you can manually specify FID to 1 (for standard output) in
% your FPRINTF statement:
%
% a='%04d';
% fprintf(1,'ls %s %i\n',a,4);
%
% Another workaround is to make multiple calls to the FPRINTF command. For
% example:
%
% a='%04d';
% fprintf('ls %s ',a);
% fprintf('%d\n',4);
%
% If you have further questions regarding this issue, please be sure to
% mention the above case ID number in your e-mail response to me.
%
% Sincerely,
%
% Jeff Mather
% Technical Support Engineer
% jmather@mathworks.com
|