/usr/share/psychtoolbox-3/PsychOneliners/GetWithDefault.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 | function inputVal = GetWithDefault(prompt,defaultVal)
% inputVal = GetWithDefault(prompt,defaultVal)
%
% Prompt for a number or string, with a default returned if user
% hits return.
%
% 4/3/10 dhb Wrote it.
if (ischar(defaultVal))
inputVal = input(sprintf([prompt ' [%s]: '],defaultVal),'s');
else
inputVal = input(sprintf([prompt ' [%g]: '],defaultVal));
end
if (isempty(inputVal))
inputVal = defaultVal;
end
|