matrix2latex

版本 1.0.0.0 (2.5 KB) 作者: Moritz Koehler
MATLAB array to LaTeX table converter.
24.0K 次下载
更新时间 2004/5/17

查看许可证

This function converts an MATLAB 2-dimensional array (matrix) which can be numerical or a cell array, into proper formated LaTeX code. The result will be a file that can be included into any LaTeX document, and will display the data through the 'tabular' environment.

% Usage:
% matrix2late(matrix, filename, varargs)
% where
% - matrix is a 2 dimensional numerical or cell array
% - filename is a valid filename, in which the resulting latex code will
% be stored
% - varargs is one ore more of the following (denominator, value) combinations
% + 'rowLabels', array -> Can be used to label the rows of the
% resulting latex table
% + 'columnLabels', array -> Can be used to label the columns of the
% resulting latex table
% + 'alignment', 'value' -> Can be used to specify the alginment of
% the table within the latex document. Valid arguments are: 'l', 'c',
% and 'r' for left, center, and right, respectively
% + 'format', 'value' -> Can be used to format the input data. 'value'
% has to be a valid format string, similar to the ones used in
% fprintf('format', value);
% + 'size', 'value' -> One of latex' recognized font-sizes, e.g. tiny,
% HUGE, Large, large, LARGE, etc.
%
% Example input:
% matrix = [1.5 1.764; 3.523 0.2];
% rowLabels = {'row 1', 'row 2'};
% columnLabels = {'col 1', 'col 2'};
% matrix2latex(matrix, 'out.tex', 'rowLabels', rowLabels, 'columnLabels', columnLabels, 'alignment', 'c', 'format', '%-6.2f', 'size', 'tiny');
%
% The resulting latex file can be included into any latex document by:
% /input{out.tex}
%
% Enjoy life!!!

引用格式

Moritz Koehler (2024). matrix2latex (https://www.mathworks.com/matlabcentral/fileexchange/4894-matrix2latex), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 LaTeX 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0

Update to v 1.1

-> Supports now LaTeX font sizes