matrix2WordEq

Macro for copying large matrices into a Microsoft Word equation matrix
104 Downloads
Updated 3 Oct 2023

View License

Copy the content of a Matlab matrix to a Word Equation matrix using the Windows clipboard.
Copy matrix into Word Equation:
1) Create a Word Equation box in the document
2) Run the matrix2WordEq function
3) Place the cursor over the Word equation box
4) Wait for the values to be copied
* Note 1: In the case of copying values into a Word Equation larger than 225 cells, the matrix structure must be manually created before calling this function (it is a Microsoft Word limitation).
* Note 2: If values are not being copied properly, increase the CopyPause time.
Ex: matrix2WordEq(M, 'CopyPause', 0.7);
* Note 3: See the documentation to get the full list of parameters (help matrix2WordEq).
Examples:
- Example 1: Copy a 4x6 matrix to a Word Equation:
1) Create an equation box in the Word document.
MS Word menu bar -> insert -> equation
2) Execute in a Matlab terminal:
matrix2WordEq(rand(4,6));
3) Navigate to the Word document and select the equation box
4) After 5 seconds (by default) the matrix will be created and the values will get copied.
- Example 2: Fill an already existing Word Equation matrix:
1) Create an equation box in the Word document.
MS Word menu bar -> insert -> equation
2) Add a 3 by 3 matrix.
With the equation box selected, navigate to "Equation tools" and add a 3x3 matrix.
3) Execute in a Matlab terminal:
matrix2WordEq(rand(3,3), 'CreateMatrix', 0);
4) Navigate to the Word document and select the top-left cell of the matrix.
5) After 5 seconds (by default) the values will start to get copied to the matrix.
- Example 3: Copy a 4x6 matrix to a Word Equation with values containing four decimal places:
1) Create an equation box in the Word document.
MS Word menu bar -> insert -> equation
2) Execute in a Matlab terminal:
matrix2WordEq(rand(4,6),'Format','%.4f');
3) Navigate to the Word document and select the equation box
4) After 5 seconds (by default) the matrix will be created and the values will get copied.

Cite As

Eduard Clotet (2026). matrix2WordEq (https://www.mathworks.com/matlabcentral/fileexchange/136095-matrix2wordeq), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Version Published Release Notes
1.0.0