Be the first to rate this file! 0 Downloads (last 30 days) File Size: 375 Bytes File ID: #9324

latex_trick.m

by Christopher Granade

 

09 Dec 2005 (Updated 12 Dec 2005)

Replaces decimal points in either a matrix or a scalar with a '&' to allow for easier handling

| Watch this File

File Information
Description

As documented in lshort.pdf, an easy way of aligning table columns in MATLAB to a decimal point is to break down the numerical entries into two columns, and set the alignment to 'r@{.}l', which places a decimal point between a right and a left aligned column.

This function changes decimal points in either a scalar or a matrix to a '&' to allow for using this technique.

For best results, combine with matrix2latex.m available on this site.

Usage:
% latex_trick(number, format)
% where:
% number is a matrix or a scalar, and
% format is a format string as if for fprintf.
% returns:
% a string if number is a scalar, or
% a string cell array otherwise.

MATLAB release MATLAB 6.5 (R13)
Other requirements iif.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
16 Nov 2007 xiang xue shuang

Thank you for you hard work!

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data import Christopher Granade 22 Oct 2008 08:09:39
data export Christopher Granade 22 Oct 2008 08:09:39
latex Christopher Granade 22 Oct 2008 08:09:39
decimal points Christopher Granade 22 Oct 2008 08:09:39
table columns Christopher Granade 22 Oct 2008 08:09:39
alignment Christopher Granade 22 Oct 2008 08:09:39

Contact us at files@mathworks.com