Reverse Engineering for matlab code?

Hi,
I want to create a flow diagram for my matlab code. Is there a tool out there which can do reverse engineering and help create the flow diagram?
Thanks

12 Comments

I don't get it. Matlab is not a compiled language. What do you mean by reverse-engineer? Don't you have the .m file?
Not aware of one, but do a search at the File Exchange and see if are any submissions there...leftmost link at top of this page...
David Young
David Young on 1 Oct 2014
Edited: David Young on 1 Oct 2014
José-Luis: MATLAB is a compiled language. But Neesha wants, I think, to reverse-engineer from the m-file to a more abstract or graphical description.
José-Luis
José-Luis on 1 Oct 2014
Edited: José-Luis on 1 Oct 2014
No, it is not compiled. It is interpreted. At least most of it is, unless we start talking JIT.
Matlab is NOT directly transformed into machine code, which is the definition of a compiled language as far as I understand it.
Way off topic, but compiled does not necessary mean machine code. See .Net languages which are compiled into the CIL (bytecode) which is only translated at runtime into machine code by the CLR.
Java works the same way.
That page actually confirms what I said, It does say that C# is compiled to bytecode (proper name is CIL). It also kind of contradict itself, as it categorises that as hybrid higher up.
It's a murky page at best. The best imo portion of it is at the very top where it says a combination of both solutions is also increasingly common: a compiler can translate the source code into some intermediate form (often called bytecode), which is then passed to an interpreter which executes it.
In my book that is still not really "compiled" and by that definition Matlab is one of those and doesn't qualify as a compiled language (and I note it's not in the list on down of those the article claims are altho I've some serious objections with quite a few on the list for the same reason).
José-Luis
José-Luis on 1 Oct 2014
Edited: José-Luis on 1 Oct 2014
This discussion is verging to semantics. I would normally leave it at that, but I am frustrated trying to decipher some Fortran code plagued with globals so I'll keep on arguing.
Whether you are right or wrong depends on how you define things. I have always understood a compiled language to be one that directly transforms text to machine code, using a compiler. Ergo not Matlab. Ergo not even C# as CIL is not machine code and needs another step of translation.
Matlab is, at most, an hybrid between interpreted and compiled. Just try running Matlab without the Java runtime.
Anyway, this all depends on how you define things and is way beyond the scope of what the OP asked.
I agree completely with your version of semantics...fwiw which ain't a lot! :)
For Fortran, look at the Understand for Fortran product from SciTools https://scitools.com/. I've successfully used it on grossly sphaghettified code. It's pricey, but they have a fully functional demo that you can use on a single project for like 15 day or so which is generally enough with it to get thru the rough patches on anything that isn't truly humongous in size.
Thanks for the tip. I'll check it out.

Sign in to comment.

Answers (0)

Categories

Tags

No tags entered yet.

Asked:

on 1 Oct 2014

Commented:

on 2 Oct 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!