/usr/share/freemat/toolbox/string/cellstr.m is in freemat-data 4.0-5build1.
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 | % CELLSTR CELLSTR Convert character array to cell array of strings
%
% Usage
%
% The cellstr converts a character array matrix into a
% a cell array of individual strings. Each string in
% the matrix is placed in a different cell, and extra spaces
% are removed. The syntax for the command is
%
% y = cellstr(x)
%
% where x is an N x M array of characters as a string.
% Copyright (c) 2002-2007 Samit Basu
% Licensed under the GPL
function A = cellstr(x)
if (iscell(x))
A = x;
return;
end
if (~isstr(x) | (ndims(x) ~= 2))
error('Argument to cellstr must be a string matrix');
end
n = size(x,1);
if (n == 1)
A = {deblank(x)};
else
A = cell(n,1);
for i=1:n
A{i} = deblank(x(i,:));
end
end
|