This function automatically extracts a MATLAB script from a Live Script (.mlx) file. Currently this can only be done through the GUI interface.
Is there a way to do the reverse? zipping a folder and open it as mlx?
Hi Uwe, I'm not an xslt guru, this was my first time attempt and it's probably an 80% solution and LiveScripts continue to evolve rapidly from what they were when this script was written. What is not translated properly?
I just run your script on a mlx file and used matlab built in conversion. Yours is faster, but also does not translate the file entirely correct. I can send you an example.
Ok I found a solution
#! /bin/csh -f
unzip -p $1 matlab/document.xml | xsltproc /home/oub/ALLES/HGs/Matlab-init/livescript2m.xslt - > $2
It seems not to work for me using matlab 2018b: I download the zip, unzip and in the same directory (which contains the .m and xls)
I run: live2script(hoja3) and obtain Attempt to execute SCRIPT hoja3 as a function:
so I try live2script(hoja3.mlx) and obtain Undefined variable "hoja3" or class "hoja3.mlx".
what do I miss?
This conversion capability is also useful from outside MATLAB. I wrote a simple shell script which streams the .m file to stdout, just like cat does, for example
% mlxcat livescript.mlx
The xslt engine in preinstalled on Mac, is available for Linux, not sure about Windows. You need to adjust PATH to reflect where the livescript2m.xslt file that's part of this download ended up.
#! /bin/csh -f
unzip -p $1 matlab/document.xml | xsltproc PATH/livescript2m.xslt matlab/document.xml
@Jan Freyberg: yes, check it out:
I hope I'm not too late on this.
From Matlab 2016b at least, you can also use:
It is the built-in function that does exactly that.
Is there any way to have a function go the other way - create a Live Script from an m-file that's split into sections (%%-delimited)?