How to run matlab .m files in google colab

0101 picture 0101 · Jun 2, 2019 · Viewed 14.5k times · Source

I am currently trying to run this repo https://github.com/Fanziapril/mvfnet which requires a step:

"Run the Matlab/ModelGeneration/ModelGenerate.m to generate the shape
model "Model_Shape.mat" and copy it to the Matlab/"

Is it possible to run a .m file in colab to do this?

Also, I have looked into oct2py library https://blink1073.github.io/oct2py/, but was not able to successfully run the file. I followed this How to run a MATLAB code on Python

Answer

korakot picture korakot · Jun 3, 2019

You need to first install octave with

!apt install octave

Then you can run your m-file with

!octave -W file.m

Here's a minimal example.