Plotting .mat data

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?


In particular, the reading/writing MAT files:

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

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.

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

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")                                

Then, (assuming A is a matrix), you can plot column 2 and 3 by

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