Re: command to save as .m file
- To: mathgroup at smc.vnet.net
- Subject: [mg113652] Re: command to save as .m file
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Sat, 6 Nov 2010 04:59:43 -0500 (EST)
- References: <iatspo$eav$1@smc.vnet.net> <ib0l94$ghv$1@smc.vnet.net>
On 05/11/10 10:11, David Bailey wrote: > On 04/11/10 09:01, Sebastian wrote: >> Hi, >> I've been searching the newsgroup and the web for an answer for this, >> but all the results were unsatisfactory: >> Is there a way to save the currently opened .nb file to a .m file by >> using a mathematica command and not the "Save as..." menu command? >> Please note that I want _all_ the cells to be written to the m file, >> not only the initialization cells. Even better would be a way to do >> this on every save of the nb, but I have given up hope that such a >> thing is possible. All this is part of my effort to find an effective >> version control solution for my mathematica files. >> TIA >> Sebastian >> > It would definitely help to explain a bit about what you want to achieve. > > However, you could read your notebook with NotebookGet, then write that > messy structure to a .m file with Save. It would really help to > understand how you want to use this. > > David Bailey > http://www.dbaileyconsultancy.co.uk > Sorry, I realised after I had written this, that you had explained what you are trying to achieve. I have a couple of extra suggestions: 1) I believe Wolfram Workbench supports version control, but I don't use this because it seems to involve a steep learning curve and is not particularly well integrated with Mathematica. 2) Notebooks are actually text files - try opening one with a text editor. Therefore, it is possible to read a notebook as lines of text from within Mathematica. David Bailey http://www.dbaileyconsultancy.co.uk