1 function tableStr=
cell2tablestr(titleList,dataCell,colSepSeq,varargin)
4 [~,~,isMatlabSyntax,isUniformOutput,minSepCount,numPrecision]=...
6 {
'isMatlabSyntax',
'uniformOutput',
'minSepCount',
'numPrecision';...
8 @(x)islogical(x)&&isscalar(x),@(x)islogical(x)&&isscalar(x),...
9 @(x)isscalar(x)&&isnumeric(x)&&(x>0)&&(fix(x)==x),...
10 @(x)isscalar(x)&&isnumeric(x)&&(x>0)&&(fix(x)==x)},0);
12 [nRows,nCols] = size(dataCell);
15 if ~isempty(titleList)
17 dataCell=[titleList;dataCell];
21 dataCell=cellfun(@
cellformatter,dataCell,
'UniformOutput',
false);
24 resCell=cell(nRowsRes,1);
26 dataColCell=dataCell(:,iCol);
27 lenColCell=cellfun(@length,dataColCell,
'UniformOutput',
false);
29 maxLength=max(lenColVec(:))+minSepCount;
30 sepCell=cellfun(@(x)(
repmat(colSepSeq,1,maxLength-x)),lenColCell,...
31 'UniformOutput',
false);
32 resCell=strcat(resCell,strcat(dataCell(:,iCol),sepCell));
38 resCell=strcat(resCell,dataCell(:,end));
40 resCell=
repmat({
''},[nRowsRes,1]);
44 resCell=cellfun(@horzcat,
repmat({
'{'},[nRowsRes,1]),resCell,...
45 'UniformOutput',
false);
46 resCell=cellfun(@horzcat,resCell,
repmat({
'}'},[nRowsRes,1]),...
47 'UniformOutput',
false);
50 %% convert to
char array
if necessary
53 tableStr=char(resCell);
59 case {
'double',
'single'}
60 outCont=num2str(inpCont,numPrecision);
62 outCont=num2str(inpCont);
64 outCont=
'<structure>';
67 outCont=num2str(inpCont);
function parseparext(in args, in propNameValMat, in varargin)
PARSEPAREXT behaves in the same way as mxberry.core.parseparams but returns property values in a more...
function repmat(in inpArray, in varargin)
function cell2tablestr(in titleList, in dataCell, in colSepSeq, in varargin)
CELL2TABLESTR - converts a cell array into a table-like char array (or a cell array of strings repres...
function cellformatter(in inpCont)
function cell2mat(in inpCArr)
CELL2MAT does the same as the built-in cell2mat function but a) 20% faster b) works with cell arrays ...