By default, gedit recognises *.m file as object-c file and this causes unwanted syntax highlighting in gedit.
There is a workaround to fix this. Note that if you update gedit or mime type sets that overwrite your modification and you need to this again afterward.
gedit uses mime type for text management and all rules can be found from
/usr/share/mime/packages/freedesktop.org.xml
Let’s open this file with sudo.
Looking for <mime-type type=”text/x-objcsrc”> and this mime-type is for object-c source code.
For some reason, *.m file is mapped as object-c file <glob pattern=”*.m”/>, just before <mime-type type=”text/x-ocaml”> line.
Let’s change <glob pattern=”*.m”/> to<glob pattern=”*.c”/> and save it.
Finally, the following command updates your modification and gedit will use Octave syntax that properly displays MATLAB script.
sudo update-mime-database /usr/share/mime
Give this try and let me know whether this works or not.