Mastering MATLAB: Step-by-Step Guide to Creating Tables

Joan Jul 01, 2026

Creating tables in MATLAB is a straightforward process, enabling you to present data in an organized and easily understandable format. Tables are essential for data analysis, visualization, and reporting. In this guide, we'll walk you through the steps to create and manipulate tables in MATLAB.

Créer une TABLE DES MATIÈRES automatique [Cours WORD] + Numérotation des titres + STYLES
Créer une TABLE DES MATIÈRES automatique [Cours WORD] + Numérotation des titres + STYLES

Before we dive into the details, ensure you have the latest version of MATLAB installed. If not, you can download it from the official MathWorks website and follow the installation instructions.

a man is pointing to a table in msw file screen with the text table in msw on it
a man is pointing to a table in msw file screen with the text table in msw on it

Creating a Table

MATLAB provides several ways to create tables. We'll explore two common methods: using arrays and using data stored in variables.

HOW TO INSERT TABLE IN MS WORD
HOW TO INSERT TABLE IN MS WORD

First, let's create a table using an array. An array is a multi-dimensional matrix containing elements of the same data type. To create a table, you can use the 'table' function, which converts an array into a table.

Using Arrays

Word: How to create a Table
Word: How to create a Table

To create a table using an array, follow these steps:

1. Define an array with your data. For example:

data = [1 2 3; 4 5 6; 7 8 9];

2. Convert the array into a table using the 'table' function:

How to Create Table Templates in Microsoft Word
How to Create Table Templates in Microsoft Word

myTable = table(data);

3. Display the table using the 'disp' function:

disp(myTable)

Using Data Stored in Variables

You can also create a table using data stored in variables. This method is useful when you have data scattered across multiple variables, and you want to combine them into a single table.

How to Format Microsoft Word Tables Using Table Styles (Ultimate Guide)
How to Format Microsoft Word Tables Using Table Styles (Ultimate Guide)

Let's create a table using variables. First, define your variables:

var1 = [1 2 3];
var2 = [4 5 6];
var3 = [7 8 9];

Next, create a table using the 'table' function and pass your variables as arguments:

How to Create and Customize Tables in Microsoft Word - Make Tech Easier
How to Create and Customize Tables in Microsoft Word - Make Tech Easier
How to create a table in Word
How to create a table in Word
an iphone screenshot showing the user's work schedule and other items on the screen
an iphone screenshot showing the user's work schedule and other items on the screen
How to Convert Text to a Table in Microsoft Word
How to Convert Text to a Table in Microsoft Word
How to Add Multiple Rows in a Table in Word - TheAppTimes
How to Add Multiple Rows in a Table in Word - TheAppTimes
How to make a table of contents in word
How to make a table of contents in word
Add Table in MS word
Add Table in MS word
Viewing Formulas in Tables in Microsoft Word 2019 and 365
Viewing Formulas in Tables in Microsoft Word 2019 and 365
The Quickest and Easiest Way to Make a Table in Word
The Quickest and Easiest Way to Make a Table in Word
Microsoft Word Lation 13 Work Table Part 1= Draw Table
Microsoft Word Lation 13 Work Table Part 1= Draw Table
How to create  a table of content in ms word
How to create a table of content in ms word
How to Create and edit table in MS Word|2010|urdu\Hindi
How to Create and edit table in MS Word|2010|urdu\Hindi
How to format a table in word to fit on one page
How to format a table in word to fit on one page
كتاب The Finite Element Method using MATLAB
كتاب The Finite Element Method using MATLAB
How to make table lines invisible in word
How to make table lines invisible in word
How to insert move and edit table in MS Word | Insert table and draw table
How to insert move and edit table in MS Word | Insert table and draw table
How to Create a Markdown Table
How to Create a Markdown Table
Best Table of Contents Template Examples for Microsoft Word
Best Table of Contents Template Examples for Microsoft Word
How to Insert Table In Microsoft Word
How to Insert Table In Microsoft Word
How to Make Table of Contents in Word
How to Make Table of Contents in Word

myTable = table(var1, var2, var3);

Finally, display the table:

disp(myTable)

Manipulating Tables

Once you've created a table, you can manipulate it using various functions and properties. MATLAB provides a wide range of tools for data manipulation, including sorting, filtering, and aggregating data.

Let's explore some common table manipulation techniques:

Sorting Tables

You can sort tables based on one or more variables using the 'sortrows' function. For example, to sort the 'myTable' created earlier in ascending order based on the second column:

sortedTable = sortrows(myTable, 2);

Filtering Tables

To filter data based on specific criteria, you can use logical indexing. For instance, to filter the 'myTable' and display only the rows where the third column is greater than 5:

filteredTable = myTable(myTable.Var3 > 5, :);

Aggregating Tables

You can aggregate data using functions like 'sum', 'mean', and 'median'. To calculate the sum of each column in the 'myTable', use the following code:

aggregatedTable = sum(myTable, 'omitnan');

In conclusion, creating and manipulating tables in MATLAB is a powerful way to organize, analyze, and present data. By mastering these techniques, you'll be well on your way to becoming a proficient MATLAB user. Happy coding!