cellarray_to_latex.m
来自「Bayes网络工具箱」· M 代码 · 共 33 行
M
33 行
function cellarray_to_latex(prefix, filename, C, titles, width)% CELLARRAY_TO_LATEX Create a latex table file containing the 2D cell array of strings% cellarray_to_latex(prefix, filename, C, titles, width)if nargin < 5, width = 1; end[nr nc] = size(C);%s = sprintf('%s/%s', prefix, filename);s = sprintf('%s', filename);fid = fopen(s, 'w');str = {};for c=1:nc str{end+1} = 'c';endfprintf(fid, '\\');fprintf(fid, sprintf('begin{tabular}{%s}\n', char(str)));nc = length(titles);for i=1:nc-1 fprintf(fid, '%s & ', titles{i});endfprintf(fid, '%s \\\\ \\hline \n', titles{nc});for i=1:nr for j=1:nc-1 fprintf(fid, '%s & ', C{i,j}); end fprintf(fid, '%s \\\\ \n', C{i,nc});endfprintf(fid, '\\end{tabular} \n');fclose(fid);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?