I am new to Julia. I have been using MATLAB for quite a while. I have few matlab matices namely, A.mat, B.mat, C.mat and so on. I have to read these matrices into Julia and then do some optimization using them. I dont know how to convert these matlab matrices to Julia matrices. I have used the pkg MAT.jl. when I use use it as: A = matopen(“A.mat”) in julia then “A” is not a matrix in julia. How do I read convert these matrices to julia matrices. Any help will be appriciated. Thanks
Note that A.mat is a file in “MAT” format, and not a matrix. In MATLAB, if you do
>> vars = load("A.mat")
you get a MATLAB struct containing the variables you saved. If the A.mat file contains a matrix A, then you can access it in MATLAB with
>> A = vars.A % or directly with A = load("A.mat").A
In Julia, you would do
julia> A = vars["A"] # or directly A = matread("A.mat")["A"]
That’s because MATLAB’s structs are essentially the same as Julia dictionaries, albeit with the syntactic difference to grab objects inside (i.e., vars.A in MATLAB vs vars["A"] in Julia).