/usr/share/psychtoolbox-3/PsychFiles/BreakLines.m is in psychtoolbox-3-common 3.0.14.20170103+git6-g605ff5c.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 | function strArray=BreakLines(str)
% strArray=BreakLines(str)
%
% Accept a string, "str", and return a cell array of strings
% broken at the line terminators in str. The terminators used in the string
% are automatically detected (see platforms list in ReplaceLineTerminators
% for supported line terminators).
%
%
% see also: ReplaceLineTerminators
% HISTORY
%
% 12/09/03 awi Wrote it.
% 07/12/04 awi Added platform sections.
% 21/10/11 dcn Actually this function works for all platforms. Edited
% help and comments in code.
%first substitute in the unix break char no matter what we start out with.
%this makes BreakLines platform independent
unixStr=ReplaceLineTerminators(str, 'unix');
unixBreakChar=char(10);
%find indices of line bounds
breakIndices=find(unixStr==unixBreakChar);
lineStartIndices=[1 breakIndices+length(unixBreakChar)];
lineEndIndices=[breakIndices-length(unixBreakChar) length(unixStr)];
% build cell array of strings by gathering between the breakpoints.
strArray={};
for i=1:length(lineStartIndices)
strArray{i}=unixStr(lineStartIndices(i):lineEndIndices(i)); %divide between line breaks
end
|