TexTab

Create formatted tables and save them as a picture like png. Saving tex files is also possible.
621 Downloads
Updated 27 Feb 2013

View License

Create the tables based on an array or a cell array. To format the table, modify format cells, which have the same format as the data table.

The picture can easily be imported to email software and word processing software like
Microsoft Word or Open Office / Libre Office. So it could help to automate the process of report generation. Exporting to .tex files is also possible.

To install, download and unzip the file and set Matlab's search path to the folder containing both Matlab package folders (+Basic, +IoFun).
Some Latex packages are needed for table creation. So, allow MickTex to install additional packages or use the complete MickTex installation.

Creating tables is quite simple:
- create a TexTab object
- Assign the table content to the object's Data property
- modify further properties to format the table
- call the writePic or writeTex method to create the table.

Example:
Data = rand(10,2); % Create some data
obj = IoFun.TexTab; % Create the TexTab object
obj.Data = [{'x','y'};num2cell(Data)]; % Assign the data including a headline
obj.BgColor(1,:) = {'bluem'}; % Format: Background color of the Headline is blue
obj.FontStyle(1,:) = {'\Large'}; % Large Font for the headline
Alerts = find(Data(:,2)>0.8); % Find high data values:
obj.Color(2,Alerts+ 1) = {'red'}; % mark them with red colour
obj.writePic('c:\temp\test.png'); % create the table and write it to a png file
% This uses Miktex and Imagemagick and is time consuming.
clear
a=IoFun.TexTab.png2data('c:\temp\test.png'); % Retrieve the Data from the png figure file. This uses ImageMagick and is time consuming

To get a deeper idea of what is possible, check the methods example1 to example4 and watch the help of the properties and methods.

Call the examples:
obj = IoFun.TexTab;
obj.example2;

Convert underlying data from the png file to a csv txt file:
IoFun.TexTab.png2csv('c:\temp\test.png','c:\temp\test.txt')


(C) Marcel Rüland
Alstom Transport Deutschland GmbH
Germany

Special Thanks to Marc Stiepel!

Cite As

Marcel Rüland (2024). TexTab (https://www.mathworks.com/matlabcentral/fileexchange/38016-textab), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!

TextTabFileExV4/+Basic/@Base/

TextTabFileExV4/+IoFun/@TexTab/

Version Published Release Notes
1.5.0.0

Bugfixes:
- Merged cells
- Multiple vertical lines
Impoved error handling for ColorDef
Any comments would be appreciated.

1.4.0.0

* Merge multiple cells (rows/cols)
T.Data =
{'a' '<' 'c'
'^' '<' 'c'
'a' 'b' 'c'};
* Supported line styles
T.LineStyle{4} ='none' %or 'thick(2)'
* Supported fonts (sans,Math):
Computer modern bright
arev font
* Bugfixes

1.3.0.0

- Fixed Error in the Example (Help entry)
- Improved checks of input data's consistency
- correction of wrong picture size (ImageMagick )
Thanks to M. Stiepel

1.0.0.0