I have a .mat file that I’ve opened using Matlab.jl with read_matfile(filename) (is there a better way/command to load .mat data on to Julia?), and I need to plot certain rows of the .mat file. How do I do so? using Plots/PyPlot preferably. Also, would it be possible to plot data from the .mat file and a .jld2 file in the same graph?

# Plotting .mat data

**affans**#2

Try https://github.com/JuliaInterop/MATLAB.jl

In particular, the reading/writing MAT files: https://github.com/JuliaInterop/MATLAB.jl#readwrite-mat-files

**jebej**#3

MATLAB.jl requires MATLAB. For simply reading mat files, you could use MAT.jl, though it might be broken on 1.0 still.

**svpillai**#4

I’ve already opened the file on Julia using Matlab.jl with the read_matfile command (I have Matlab installed, but need to do the plotting specifically on Julia; I’m using v1.0.2). The Github Matlab.jl doesn’t mention plotting from .mat specifically, and I also don’t particularly know how to plot from both the .mat file and the .jld2 file on the same graph.

**jebej**#5

If your data has been imported already, you need a plotting package to plot it. Here are some references to get you started:

https://julialang.org/downloads/plotting.html

https://en.wikibooks.org/wiki/Introducing_Julia/Plotting

**svpillai**#6

How do I specify in my code specifically one row to plot out of the entire dataset? p = plot(file, x=[:1]) just plots the entire 150x40 matrix in the file.

First load the mat file with eg.

```
using MAT
fh = matopen("MatFile.mat")
println("\nVariables in mat file: ",names(fh))
(A,B) = read(fh,"A","B")
close(fh)
```

Then, (assuming `A`

is a matrix), you can plot column 2 and 3 by

`plot(A[:,2:3])`

.

See the Plots.jl or PyPlot.jl documentation for more details.