/usr/share/psychtoolbox-3/PsychOneliners/IsACell.m is in psychtoolbox-3-common 3.0.9+svn2579.dfsg1-1.
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 | function bool = IsACell(input,fhndl)
% bool = IsACell(input,fhndl)
%
% checks if there is any element in the cell INPUT that satisfies the
% logical condition in function FHNDL
% works recursively: cells in cells (etc) also checked
% the function FHNDL must return a scalar
%
% examples:
% checks if there is any struct in the cell:
% fhndl = @isstruct
% check if there is any element in the cell extending
% over more than 2 dimensions:
% fhndl = @(x)ndims(x)>2
%
% DN 2008-05-28
psychassert(iscell(input),'IsACell: Input must be cell, not %s',class(input));
if fhndl(input)
bool = true;
return;
else
bool = false;
end
qtest = cellfun(fhndl,input);
qcell = cellfun(@iscell,input);
if AnyAll(qtest)
% cell found with data in it that satisfies the logical condition in
% FHNDL
bool = true;
elseif AnyAll(qcell)
% cells found in the cell, process also
[lind] = find(qcell);
for p=1:length(lind)
bool = IsACell(input{lind(p)},fhndl);
if bool
return;
end
end
end
|