From: shahnaz fatima on 26 Jun 2010 22:51 hello everyone here. i want to know is it possible to convert .mex to .m file? waiting for reply
From: James Tursa on 27 Jun 2010 01:01 "shahnaz fatima" <shahnaz1981fat(a)gmail.com> wrote in message <i06eao$jcv$1(a)fred.mathworks.com>... > hello everyone here. > > i want to know is it possible to convert .mex to .m file? If you are asking about converting a compiled mex file to an m-file, then the answer is no. James Tursa
From: us on 27 Jun 2010 02:30 "shahnaz fatima" <shahnaz1981fat(a)gmail.com> wrote in message <i06eao$jcv$1(a)fred.mathworks.com>... > hello everyone here. > > i want to know is it possible to convert .mex to .m file? > > waiting for reply no us
From: Walter Roberson on 4 Jul 2010 12:21 shahnaz fatima wrote: > hello everyone here. > > i want to know is it possible to convert .mex to .m file? > > waiting for reply Yes, it is. .mex files use a finite deterministic instruction set (except the clock cycle counters), and operate on a fixed finite amount of memory. A .mex file is thus equivalent to a practically-implementable Turing Machine, and according to Turing's theories of computation, any Turing Machine can be implemented in terms of a "Universal Turing Machine" which can in turn be implemented in any "sufficiently powerful language" (which Matlab is.) To phrase this another way: you can write a Matlab program that emulates the machine instruction set of the .mex file, and then you can use that ..mex file as input to the Matlab program, perhaps as a sequence of constant data. The .mex file will then have been converted to a .m file. This kind of project is the same idea as the well-known Linux project "Wine", and as the Mac OS-X commercial program "Parallels". I would, of course, ask whether it is worth the bother to do this. And note that doing this won't give you any insight into the algorithms the mex file uses that you could not more easily get in other ways such as by using a "decompiler".
From: James Tursa on 4 Jul 2010 14:53 Walter Roberson <roberson(a)hushmail.com> wrote in message <iy2Yn.4543$KT3.4436(a)newsfe13.iad>... > shahnaz fatima wrote: > > hello everyone here. > > > > i want to know is it possible to convert .mex to .m file? > > > > waiting for reply > > Yes, it is. .mex files use a finite deterministic instruction set > (except the clock cycle counters), and operate on a fixed finite amount > of memory. A .mex file is thus equivalent to a practically-implementable > Turing Machine, and according to Turing's theories of computation, any > Turing Machine can be implemented in terms of a "Universal Turing > Machine" which can in turn be implemented in any "sufficiently powerful > language" (which Matlab is.) > > To phrase this another way: you can write a Matlab program that emulates > the machine instruction set of the .mex file, and then you can use that > .mex file as input to the Matlab program, perhaps as a sequence of > constant data. The .mex file will then have been converted to a .m file. > > This kind of project is the same idea as the well-known Linux project > "Wine", and as the Mac OS-X commercial program "Parallels". > > > I would, of course, ask whether it is worth the bother to do this. > > And note that doing this won't give you any insight into the algorithms > the mex file uses that you could not more easily get in other ways such > as by using a "decompiler". I don't know what to make of this reply, Walter. It almost sounds like you are serious. In addition to just the mex routine itself, you would also have to do the same thing with all functional dependencies. So you would have to "decompile" all of the compiled MATLAB intrinsic functions that it depended on, all of the third party dll stuff it depended on (e.g., MSVC libraries), and you would have to provide something to replace all of the system service calls, memory management, etc. So that means either decompiling parts of the operating system itself or rewriting such parts. Even if you went to all this effort it would likely run several orders of magnitude slower. I would think a better approach would be to just write the function from scratch based on the interface definition. James Tursa
|
Next
|
Last
Pages: 1 2 Prev: Saving a function data to a text file Next: PIL co-simulation runs too slow |