This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function output = mat2latex(varargin) | |
%This function produces Latex code for any matlab matrix of any dimension. | |
%It requires the package amsmath in latex for successful operation. This | |
%code utilizes bmatrix environment.This code produces square brackets to | |
%enclose the elements of the matrix.This function has to be run as an | |
%argument for the builtin fprintf() function to work properly. For example | |
%this fprintf(mat2latex(A)).Decimal numbers are left as decimal numbers by default. | |
%If you want the decimal numbers to be formatted as rational numbers, pass | |
%in a second parameter 'ratio' with your matrix. For example,fprintf(mat2latex(A,'ratio')) |
NewerOlder