Code covered by the BSD License  

Highlights from
TexTab

Be the first to rate this file! 10 Downloads (last 30 days) File Size: 14.3 KB File ID: #38016
image thumbnail

TexTab

by

 

05 Sep 2012 (Updated )

Create formatted tables and save them as a picture like png. Saving tex files is also possible.

| Watch this File

File Information
Description

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!

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Other requirements Miktex (ver. 2.9 or higher) http://miktex.org/2.9/setup ImageMagick http://www.imagemagick.org Ghostscript http://downloads.ghostscript.com/public/gs906w32.exe
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
24 Oct 2012 Marcel Rüland

Hello Wei, Thanks for your answer.
I don't have any Linux or OSX computer, so I can just try to give some hints:
1. Relpace lines 419 and 420 with something like: TempDir = 'Path/of/temp/directory';
2. Check, if the syntax for calling the following system commands is correct:
texi2dvi, dvips, convert, identify
3. use the appropriate linux command for the following Commands:
remove file (DOS: del, Linux: rm?)
Sorry, I can't give you any further help. Please tell me, if you have further questions or if you succeed.

22 Oct 2012 wei

Thank you very much.
It is very good. However, it could not be used under Mac or Linux, even after I have replace the dos() with the system(). Could you please recode it to work under Mac or Linux?

Updates
14 Feb 2013

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

22 Feb 2013

* 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

27 Feb 2013

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

Contact us