MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

# convert Matlab array to Latex

Asked by Del on 18 Jun 2013

I have an array of cells which I want to convert into a latex table.

I know for a simple array I can use the following command:

A = [1 2 3; 4 5 6; 7 8 9];
latex_table = latex(sym(A))


Which will create

latex_table =

\left(\begin{array}{ccc} 1 & 2 & 3\\ 4 & 5 & 6\\ 7 & 8 & 9 \end{array}\right)


However, if I have something like this

B = ['Hello World' '2' '3'; 'yes' 'a' '6'; 'yes' '8' 'john']


How can I create a latex table from the matrix B?