matrix2latex
Version 1.0.4 (2,63 ko) par
Marion Ranaivombola
Conversion of MATLAB 2d array, into a LaTeX table.
Modified matrix2latex, submitted by M. Koehler, to :
- remove all warning
- added an inputpaser instead of the IF and FOR loop and to add varargs
Usage:
matrix2latex(matrix, filename, varargs)
where
- matrix is a 2 dimensional numerical
- 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); the default value is '%-6.2f'.
- 'size', 'value' -> One of latex' recognized font-sizes, e.g. tiny, HUGE, Large, large, LARGE, etc.
- 'caption', 'value' -> caption of table on latex.
- 'version', 'value' -> value = 'normal' conserve all edges of the table ; value = 'light' delete all edges, except the lines around 'columnLabels' and at the end of the table. the default value is 'normal'.
Example input:
matrix = [1.5 1.764; 3.523 0.2];
rowLabels = {'row 1', 'row 2'};
columnLabels = {'col 1', 'col 2'};
% light version
matrix2latex(matrix, 'out.tex',...
'rowLabels', rowLabels,...
'columnLabels',columnLabels',...
'caption','My table', ...
'version','light');
% normal version
matrix2latex(matrix, 'out.tex',...
'rowLabels', rowLabels,...
'columnLabels',columnLabels',...
'caption','My table');
The resulting latex file can be included into any latex document by:
/input{out.tex}
Citation pour cette source
Marion Ranaivombola (2024). matrix2latex (https://www.mathworks.com/matlabcentral/fileexchange/107200-matrix2latex), MATLAB Central File Exchange. Récupéré le .
Compatibilité avec les versions de MATLAB
Créé avec
R2021b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS LinuxTags
Remerciements
Inspiré par : matrix2latex
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
Version | Publié le | Notes de version | |
---|---|---|---|
1.0.4 | edition of the function's name |
||
1.0.3 | minor correction about license |
||
1.0.2 | Minor correction of the text description |
||
1.0.1 | add of the input 'version' in order to conserve all edges of the table (version =normal) or to delete all edges, except the lines around 'columnLabels' and at the end of the table (version=light) |
||
1.0.0 |