File: fprintfEmpty.m

package info (click to toggle)
psychtoolbox-3 3.0.14.20170103%2Bgit6-g605ff5c.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,044 kB
  • ctags: 69,483
  • sloc: ansic: 167,371; cpp: 11,232; objc: 4,708; sh: 1,875; python: 383; php: 344; makefile: 207; java: 113
file content (56 lines) | stat: -rw-r--r-- 1,637 bytes parent folder | download | duplicates (2)
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
50
51
52
53
54
55
56
function fprintfEmpty
% Mathworks Case ID: 297266, reported 10/3/99.
% 
% FPRINTF terminates when it gets an empty matrix [].
% 
% dear mathworks
% 
% i was very surprised to discover a bug in FPRINTF today:
% 
% x=1;
% y=1;
% fprintf('x %d y %d\n',x,y);
% PRODUCES THIS EXPECTED OUTPUT:
% x 1 y 1
% 
% x=[];
% y=1;
% fprintf('x %d y %d\n',x,y);
% PRODUCES THIS UNEXPECTED OUTPUT:
% x 
% WHEREAS I EXPECTED THIS OUTPUT:
% x [] y 1
% 
% when the variable's value is the empty matrix, FPRINTF terminates the 
% printout prematurely, suppressing the rest of it. The FPRINTF 
% documentation provided by HELP and DOC says nothing of this awkward 
% behavior. I expected FPRINTF to print the Matlab symbol for empty matrix, 
% "[]". 
% 
% Using the empty matrix to represent missing values is one of the great 
% features of Matlab. Having FPRINTF abort the rest of the print out, and 
% my data, is contrary to the whole spirit of coping gracefully with 
% missing values.
% 
% I suspect that this bug is platform-independent. I'm running Matlab 5.2.1 
% on a PowerMac. I know that MathWorks has no current plans to upgrade the 
% OS9 version, but I understand that it is still logging bugs, to keep its 
% options open. 
% 
% denis pelli
% professor of psychology and neural science at nyu
% apple developer
% 
%
% Reported as a bug to Mathworks on 10/3/99, Case ID: 297266. Their reply (10/4) follows:
% 
% "The behavior you reported is caused by a bug which has been forwarded to
% development for cosideration in a future release of Matlab."
% 
% Kelly Bletsis
% Technical Support Engineer
% kbletsis@mathworks.com
% 
%  
% Denis Pelli