6

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

0101
  • 1,036
  • 2
  • 14
  • 24
  • I think Google Colab can only run iPython notebooks and some bash commands through the iPython notebook, so you could try to run the .m file by uploading it to Colab and using `!matlab file.m` (basically replace matlab with maybe octave or some other MATLAB compiler which can be installed in Colab, and you use exclamation mark before the command to indicate it is to be run like a bash command). – akshayk07 Jun 03 '19 at 05:11

1 Answers1

8

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.

korakot
  • 37,818
  • 16
  • 123
  • 144
  • 1
    after getting the mat file generated, I get raise ValueError('Unknown mat file type, version %s, %s' % ret) ValueError: Unknown mat file type, version 57, 54 – 0101 Jun 03 '19 at 16:36