How to open a .mat file without MATLAB (5 free ways)
By MegaRows · Published · Updated · 10 min read
Someone sends you a .mat file: a test log, a Simulink run, the data behind a paper. You don’t have MATLAB, and double-clicking it does nothing useful. This guide compares five free ways to open it, explains why a file opens in one tool and not in another (it is usually the v7.3 format), and shows how to turn the data into a CSV. The quickest is in your browser: the MegaRows viewer opens every version, v7.3 included, with timeseries, tables, timetables and Simulink Datasets. We ran every command and code sample on test files in each MAT-file version. No .mat file of your own yet? Download a sample MATLAB MAT file.
The five ways at a glance
| Method | Install | Uploads your file? | Size limit | Charts | v7.3 | Cost |
|---|---|---|---|---|---|---|
| MegaRows | None, any modern browser | No, read on your device | Your device’s memory; files of several GB open | Yes: zoomable, linked charts and statistics | Yes | Free, no account |
| Python (scipy, h5py) | Python and two packages | No | Your computer’s memory | With matplotlib (code) | Yes, with h5py | Free |
| GNU Octave | Octave, a desktop app | No | Your computer’s memory | Yes, with plot commands | Partly: plain numeric arrays | Free |
| MATLAB Online | None, but you sign in | Yes, to MATLAB Drive | 5 GB of MATLAB Drive storage on the free tier | Yes, full MATLAB | Yes | Free tier: 20 hours a month, MathWorks account |
| VS Code extension | VS Code and the extension | No | Not stated for .mat files | No, tables of values | No (v6 and v7 only) | Free |
| Other online viewers | None | Depends on the site: check before you drop a file | Depends on the site | Varies | Varies | Free or paid |
Quick rule: to look at the data and plot it, use a viewer. To process it, use Python or Octave. If the file is full of MATLAB objects other than timeseries, tables and timetables, you need MATLAB itself, and MATLAB Online is the free way in.
Option 1: MegaRows, read it online in your browser
The MegaRows MAT file viewer is a free web page that opens .mat files on your own device, with nothing to install and no account.
Open your .mat file now, without uploading it
- Every version: v4, v6, v7 and v7.3, including Simulink- and dSPACE-style logs and files written by Python.
- Finds your signals: logs in Simulink’s To Workspace formats, dSPACE-style rasters, structs, numbers inside cell arrays and matrices with channel names become tables, one per time base. Switch between them in the table picker.
- Millions of samples: four channels of 10 million samples each open in seconds on a recent laptop.
- Linked charts and statistics: charts side by side that zoom together, and the minimum, maximum, mean and standard deviation of every signal.
- Math: formulas, low-, high- and band-pass filters, FFT and PSD, transfer functions (FRF) with coherence, and rainflow counting.
- CSV export: download the plotted signals for the range in view.
- Private: the file never leaves your device, on a laptop or a phone.
Check it yourself: open your browser’s developer tools (F12, or ⌥⌘I on a Mac), select the Network tab and open a file. No request carries your data.
Drop the file onto the viewer or click “Choose a file”. The viewer recognises the version, groups the signals that share a time vector into tables and plots the first one against time. You can also open several .mat files at once and plot run A against run B.
Pros: nothing to install; works on any device, phones included; every MAT-file version; charts, statistics and math in one place; private.
Cons: containers.Map objects and your own classes are listed but not opened (see below); it reads files but doesn’t edit them; limited by your device’s memory.
Option 2: Python with scipy (v7 and older) or h5py (v7.3)
Python is free and the usual choice when you want to process the data further. The library you need depends on the file version. scipy.io.loadmat reads v4, v6 and v7 files (SciPy’s documentation says “v4 (Level 1.0), v6 and v7 to 7.2”) and stops at a v7.3 file with this error:
NotImplementedError: Please use HDF reader for matlab v7.3 files, e.g. h5pyInstall the packages with pip install scipy h5py, then pick the section for your file.
v4, v6 and v7 files: scipy.io.loadmat
from scipy.io import loadmat, whosmat
# List the variables without loading them: (name, size, class)
for name, shape, cls in whosmat("run.mat"):
print(name, shape, cls)
# Load the file; simplify_cells turns structs into dicts and cell arrays into lists
data = loadmat("run.mat", simplify_cells=True)
simout = data["simout"]
print(list(simout)) # the struct's fields
t = simout["time"] # a NumPy array
sig = simout["signals"][0] # a struct array becomes a list of dicts
print(sig["label"], sig["values"].shape)Output for our test file, a Simulink-style log in “Structure with time” format:
simout (1, 1) struct
yout (1, 1) struct
ArrayFmt (300, 3) double
['time', 'signals', 'blockName']
speed (501,)Without simplify_cells=True, a struct comes back as a NumPy record array and you need indexing such as data["simout"]["time"][0, 0] to reach a field. To read only some variables from a big file, pass variable_names=["simout"].
v7.3 files: h5py
A v7.3 file is an HDF5 file with a 512-byte MATLAB header in front, so h5py opens it directly. You get MATLAB’s raw storage, though, with three quirks:
- Arrays come back transposed. MATLAB stores arrays column by column, so a 300×3 matrix reads as (3, 300). Add
.T. - Text is stored as numbers: UTF-16 character codes, not strings.
- Cell arrays and struct arrays hold references to data in a hidden
#refs#group, which you follow withf[ref].
import h5py
with h5py.File("run_v73.mat", "r") as f:
print(list(f.keys())) # variable names (#refs# is MATLAB's own)
a = f["ArrayFmt"][()] # read a whole variable into NumPy
print(a.shape) # (3, 300): MATLAB's 300x3, transposed
a = a.T
t = f["simout/time"][()].ravel() # struct fields are paths
name = f["simout/blockName"][()] # text is stored as UTF-16 codes
print("".join(chr(c) for c in name.ravel()))
ref = f["simout/signals/values"][0, 0] # struct arrays and cells hold references
print(f[ref][()].T.shape)Output for the same test log in v7.3 format:
['#refs#', 'ArrayFmt', 'simout', 'yout']
(3, 300)
model/To Workspace
(501, 1)If you would rather get dictionaries like loadmat’s, the mat73 package (pip install mat73) does the work for you: mat73.loadmat("run_v73.mat") returned our test file with the arrays the right way round, text decoded and references followed.
Pros: free; scriptable and repeatable; every version; h5py can read a slice of a large v7.3 variable without loading all of it.
Cons: needs Python and some code; two libraries for two formats; no overview until you write plotting code.
Option 3: GNU Octave
Octave is a free, open-source program whose language is largely compatible with MATLAB’s, and its load command reads MAT-files directly. Install it from octave.org (Windows, macOS and Linux), then:
whos -file run.mat % list the variables without loading them
s = load("run.mat"); % load everything into a struct
s.simout.signals(1).label % reach into structs as in MATLAB
plot(s.simout.time, s.simout.signals(1).values)
csvwrite("speed.csv", [s.simout.time, s.simout.signals(1).values])In our tests with Octave 11.1, v4, v6 and v7 files loaded fine, structs and cell arrays included. v7.3 is another story: Octave’s manual says it “does not yet implement MATLAB’s v7.3 binary data format”, and with our v7.3 test files it loaded only plain numeric matrices, skipped struct and cell arrays, returned text as numbers, and gave up on one file with an error.
Pros: free and offline; MATLAB-style commands, so simple MATLAB scripts often run unchanged; plots.
Cons: a sizeable install; v7.3 support is partial; in our test, a file containing a MATLAB table didn’t load at all.
Option 4: MATLAB Online
MATLAB Online runs the full MATLAB in your browser, and its basic version is free with a MathWorks account: 20 hours per calendar month, sessions that end after 15 idle minutes, and 5 GB of MATLAB Drive storage. Upload the file to MATLAB Drive at matlab.mathworks.com, then double-click it or type load. Every version opens, and so do tables, timetables and Simulink objects.
The catch is the upload: your file is copied to MathWorks’ cloud. Check your company’s rules before you upload test or customer data. Once the 20 hours are used up, access stops until the first day of the next month.
Pros: the real MATLAB, so every format and object type; plots and the Variables editor; nothing to install.
Cons: needs a MathWorks account; the file is uploaded; a 20-hour monthly limit on the free tier.
Option 5: Simulink Data Explorer for VS Code
In August 2026 MathWorks released Simulink Data Explorer, a free, open-source extension for Visual Studio Code that reads Simulink models, data dictionaries, projects and MAT-files with “no MATLAB or Simulink installation required”. Install it from the Extensions view or a terminal:
code --install-extension mathworks.simulink-data-explorerA .mat file then opens read-only as a tree-structured table of its variables, and a matrix such as <2x3x2 double> opens in a spreadsheet-style grid. Only files saved with -v6 or -v7 are supported (v7.3 files are reported as unsupported), and there are no charts.
Pros: free, offline and from MathWorks; handy if you already use VS Code, especially alongside Simulink models and data dictionaries.
Cons: no v7.3; no plotting; you need VS Code.
Other options
- HDFView. The HDF Group’s free desktop viewer opens v7.3 files, because they are HDF5 files. You see the same raw layout as in h5py: transposed arrays, text as numbers and references.
- R. The R.matlab package’s
readMat()reads v4 to v7 files, compressed ones included, but not v7.3. For v7.3, use an HDF5 package such as rhdf5. - Julia. MAT.jl reads every version from v4 to v7.3 with
matread("file.mat"). - Online viewers and converters. No install. Some send your file to their server and some read it in your browser, and size limits differ: read their privacy wording and watch the Network tab of your browser’s developer tools before you drop work data into one.
Which version is my .mat file?
Most problems come down to the version. Every MAT-file saved as v6 or later starts with a 128-byte header whose first 116 bytes are text. On macOS or Linux, print it in a terminal:
head -c 128 run.matA few binary bytes follow the text and may show as odd characters. Compare the start with these two examples:
MATLAB 5.0 MAT-file, Platform: GLNXA64, Created on: Sun Oct 4 12:00:00 2026MATLAB 7.3 MAT-file, Platform: GLNXA64, Created on: Sun Oct 4 12:00:00 2026 HDF5 schema 1.00 .- “MATLAB 5.0 MAT-file” means v6 or v7. Both use MATLAB’s Level 5 format (v7 adds compression), and every tool in this guide reads them.
- “MATLAB 7.3 MAT-file … HDF5 schema” means v7.3. Use MegaRows, h5py or mat73, MATLAB Online or another HDF5 tool.
- No readable text means MATLAB’s oldest format, v4 (which scipy, Octave and MegaRows read), or a file that isn’t from MATLAB: a few unrelated programs use the .mat extension too.
On Windows, or anywhere with Python, print the same text with one line:
python -c "print(open('run.mat', 'rb').read(116).decode('latin-1'))"or let SciPy decide:
from scipy.io.matlab import matfile_version
print(matfile_version("run.mat")) # (0, 0) = v4, (1, 0) = v6 or v7, (2, 0) = v7.3Why v7.3 needs HDF5 tools. Since MATLAB R2006b, save -v7.3 writes an HDF5 file with MATLAB’s 512-byte header in front; the HDF5 signature sits at byte 512. MATLAB needs this format for variables of 2 GB or more, and its matfile function creates v7.3 files by default, while a plain save still writes v7. Level 5 readers can’t parse HDF5, and HDF5 libraries see MATLAB’s raw storage, which is why scipy.io.loadmat, R.matlab and the VS Code extension can’t read v7.3 files and h5py shows their arrays transposed. For a general .h5 or NetCDF-4 file, use the HDF5 dataset viewer; use the MAT viewer for MATLAB structures.
Tables, timetables and Simulink objects
Some variables are hard to open anywhere but MATLAB. Tables, timetables, timeseries, datetime, string and categorical arrays, and Simulink’s Dataset and SimulationOutput objects are stored in an undocumented, MATLAB-only form. SciPy returns them as opaque placeholders and h5py shows a short array of numbers tagged with the class name. MegaRows reads timeseries (alone, in structs, in a tscollection or in a logged Dataset), whole simulation outputs, Simulation Data Inspector exports, tables, timetables, and datetime, duration, string and categorical arrays, from v7 and v7.3 files alike; it lists the other objects (such as containers.Map and your own classes) in the notes and opens everything else in the file.
This matters for Simulink logs: the To Workspace block saves in Timeseries format by default, and new models return everything in a single SimulationOutput object called out. MegaRows opens out saved as it is, with its logsout, yout, xout, tout and To Workspace variables each in their own tables. For the other tools here, ask whoever made the file to run these MATLAB lines: they produce a file that every tool can read.
% A table becomes a struct with one field per column
s = table2struct(T, 'ToScalar', true);
save('data.mat', '-struct', 's', '-v7')
% Simulink: set the To Workspace block's Save format to "Structure With Time", then
simout = out.simout;
save('run.mat', 'simout', '-v7')For a timetable, call timetable2table first.
Convert a .mat file to CSV or Excel
Excel can’t open a .mat file, but it opens CSV. There are two easy ways to get one.
With MegaRows
Use the free tool to convert MAT to CSV: open the file, tick the signals you need (up to eight per chart) and choose Do more › Download chart data (CSV). You get the plotted signals, time first, for the range in view: zoom out fully for the whole recording, or zoom in for a single event. There is no direct Excel export yet, and Excel stops at 1,048,576 rows per sheet; for longer recordings, see how to open a CSV file that’s too big for Excel.
With Python and pandas
This turns the matrix and channel names in our sample Simulink-style log into a CSV and an Excel workbook (install pandas and openpyxl first):
import pandas as pd
from scipy.io import loadmat
data = loadmat("megarows-sample-simulink.mat", simplify_cells=True)
df = pd.DataFrame(data["simout"], columns=data["simout_names"])
df.to_csv("simout.csv", index=False)
df.to_excel("simout.xlsx", index=False) # needs openpyxl
print(df.shape) # (12001, 7)For a v7.3 file, read the arrays with h5py or mat73 as shown above, transpose them, and pass them to pd.DataFrame the same way. In Octave, csvwrite does the same job.
Going the other way, from a CSV to a .mat file? See how to convert CSV to a MATLAB .mat file.
Have a .mat file to hand?
Drop it into the MAT file viewer. It’s free, needs no account or install, and your file never leaves your device.
Open the MAT file viewerFrequently asked questions
Can I open a .mat file in Excel?
Not directly: Excel has no import for MATLAB’s binary format. Convert the file to CSV first, with MegaRows or a few lines of Python, then open the CSV in Excel. Keep in mind that a sheet holds at most 1,048,576 rows.
Why does a text editor show gibberish when I open a .mat file?
Because a .mat file is binary. Only the start of the header, such as “MATLAB 5.0 MAT-file, Platform: …”, is text. After it, the numbers are stored as raw bytes, compressed in v7 files. Don’t save the file from a text editor: that can damage it.
Is it safe to upload work data to an online .mat viewer?
It depends on the site and on your company’s rules. Some online tools send the file to their server and some read it in your browser; their privacy wording and the Network tab of your browser’s developer tools show which. MATLAB Online keeps files in MathWorks’ cloud (MATLAB Drive). MegaRows reads the file in your browser and never sends it anywhere, which you can confirm in the Network tab.
What is a v7.3 .mat file, and why won’t it open?
v7.3 is MATLAB’s HDF5-based format, needed for variables of 2 GB or more. scipy.io.loadmat, R.matlab and the VS Code extension don’t support it, and GNU Octave reads only parts of it. MegaRows, MATLAB Online, h5py or mat73 in Python, MAT.jl in Julia and HDFView all open it.
Do I need a MathWorks account to open a .mat file?
Only for MATLAB Online and MATLAB Mobile. MegaRows, Python, GNU Octave and the Simulink Data Explorer extension for VS Code work without a MathWorks account or a MATLAB licence.
Can I open a .mat file on a phone?
Yes. MegaRows works in the browser on iPhone, iPad and Android, and the file stays on your phone. MATLAB Mobile also works, but it runs MATLAB on MathWorks’ cloud, needs a MathWorks account, and its full functionality requires a MATLAB licence.
Can I edit or create a .mat file without MATLAB?
Yes, with code. Python’s scipy.io.savemat writes v4 to v7 files, GNU Octave’s save writes v6 and v7 files but not v7.3, and the Python package hdf5storage and Julia’s MAT.jl write v7.3. Viewers, MegaRows included, only read files.
Related tools and guides
- CSV plotterOpen a CSV, Excel, TXT, JSON, MATLAB, Parquet, HDF5 or LabVIEW TDMS file with millions of rows and plot it in several linked charts, with zoom and statistics. Works today.
- Large CSV viewerOpen a CSV with millions of rows in your browser: scroll every row, see each column’s type and statistics, chart any column. Works today.
- MATLAB .mat file viewerOpen v4 to v7.3 .mat files without MATLAB and plot any signal. Works today.
- Parquet viewerOpen large .parquet files, see the schema at once and plot millions of rows, without Python. Works today.
- TDMS viewerOpen .tdms files from LabVIEW, DIAdem and DAQmx loggers: every group, channel and property, each channel plotted against its time. Works today.
- HDF5 viewerOpen .h5, .hdf5 and NetCDF-4 .nc files: every group, dataset and attribute, each group’s datasets plotted against their time. Works today.
- MAT to CSVConvert the signals of a .mat file, v4 to v7.3, to a CSV for Excel or Python, without MATLAB. Works today.
- Parquet to CSVConvert a .parquet file to CSV in your browser, with the columns you pick. Works today.
- TDMS to CSVConvert the channels of a .tdms file to CSV, a group at a time, with its time column, without LabVIEW or Excel add-ins. Works today.
- HDF5 to CSVConvert the datasets of an .h5 or NetCDF-4 file to CSV, a table at a time, with its time column, without Python. Works today.
- Excel to CSVConvert any sheet of an .xlsx or .xlsm workbook to CSV, with the saved results of formulas, real dates and 15 significant digits. Works today.
- JSON to CSVConvert JSON and JSON Lines files to CSV: nested fields become columns named by their path, arrays stay as JSON text. Works today.
- CSV to MATConvert a CSV, Excel, JSON or Parquet file to a MATLAB .mat file: a field per column, with names and units, every row. Works today.
- Merge CSV filesAppend many CSV files into one, even with different columns or separators. Works today.
- Split CSV filesSplit a CSV too big for Excel into parts of 1,000,000 rows, parts of a size you choose, or one file per value of a column. Works today.
- CSV row counterCount the lines in a CSV, TSV or TXT file of any size. Works today.
- CSV statisticsCount, missing values, min, max, mean, standard deviation, RMS and peak to peak of each number column, for the whole file or the rows you zoom into. Works today.
- CSV histogramA histogram of any number column, with automatic bins or 10 to 200 of them, and each bin’s count as a table. Works today.
- CSV too large for Excel?Open every row of a CSV beyond Excel’s 1,048,576-row limit, or work around the limit in six other ways.
- FFT and PSD from a CSVTurn a signal column into an FFT spectrum or a PSD with Grms, with results checked against SciPy. Works today.
- PSD calculatorTurn a vibration column into a power spectral density (Welch) in g²/Hz, with the Grms of any band and a dB view. Works today.
- Spectrogram from CSVSee how the frequencies of a measured signal change over time, as a heat map in dB, with the window and range you choose. Works today.
- FRF and coherencePick an input and an output column and get the frequency response (H1, H2, magnitude and phase) and their coherence. Works today.
- The MegaRows toolboxWhat works today and what is coming next, and why nothing is ever uploaded.
Coming soon to MegaRows: CSV to Excel and PDF reports · Compare CSV versions.