Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Mathematica 9 does not read mathematica 8 ".mx" files

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129121] Re: Mathematica 9 does not read mathematica 8 ".mx" files
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Mon, 17 Dec 2012 02:53:47 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121211072405.120E06877@smc.vnet.net> <CAEtRDSc0u8QF3EL-+=Of79Mq5fhD1ZjWOYYYMKWLJo7Ojuc7Nw@mail.gmail.com> <kaem7o$5mu$1@smc.vnet.net>

On 14/12/2012 07:58, noomen mechri wrote:
> Thanks for your reply!
> yes, that's what I had to do ... rerun the whole calculation on M9 which
> again took a few hours!! (I know ... not good at optimizing code)
> But then what is the purpose of having .mx files to save the workspace
> variables for future use ... if they can only be read by the version in
> which they have been produced ... it is senseless ...
>
>
> On Tue, Dec 11, 2012 at 9:03 PM, Bob Hanlon<hanlonr357 at gmail.com>  wrote:
>
>> I've never used an .mx file; however, from the documentation:
>>
>> "MX files cannot be exchanged between different operating systems or
>> versions of Mathematica."
>>
>> "Mathematica MX files can be created with DumpSave and read with Get."
>>
>> Did you save the source files from which you did a DumpSave? If so,
>> move the source files to v9 and DumpSave new .mx files in v9.
>>
>>
>> Bob Hanlon
>>
>>
>> On Tue, Dec 11, 2012 at 2:24 AM, NBM<noomenov at gmail.com>  wrote:
>>> Having written a lot of code on M8, I recently switched to M9 and tried
>> to
>>> run the code which starts by loading an .mx file written by M8, but M9
>> wouldn't read it saying that it was written on another machine. This is a
>> major incompatibility issue between M8 and M9. Fortunately I kept my M8
>> installation, so for now, M9 is useless to me.
>>> Please a solution.
>>>
>>
>
I hit the restriction with .mx files some time ago.

I really needed high speed, and I timed various alternatives. The best I 
found, was to write the data:

  str=OpenWrite[file,BinaryFormat->True];
       BinaryWrite[str,magic,"TerminatedString"];
       BinaryWrite[str,Compress[{expr,version}],"TerminatedString"];
       Close[str];

(where magic is a short string to use as a sanity check when reading 
back - omit if you prefer. expr is the large expression)

This can be read back with:

str=OpenRead[file,BinaryFormat->True];
    If[BinaryRead[str,"TerminatedString"]==magic,
       expr=Uncompress[BinaryRead[str,"TerminatedString"]];
       ];
    Close[str];

The important point here, is that Compress and Uncompress are both fast 
and portable.

This isn't quite as fast as .mx files, but close!

David Bailey
http://www.dbaileyconsultancy.co.uk








  • Prev by Date: Re: Mathematica strange behaviour finding a cubic root
  • Next by Date: Re: How can a sub picture be resized with a Row?
  • Previous by thread: Re: Mathematica 9 does not read mathematica 8 ".mx" files
  • Next by thread: Re: Mathematica 9 does not read mathematica 8 ".mx" files