2

I have been using Java for 2-3 years now, and I love it. Since I am switching to work/study in academia I have to use MATLAB for lots of things (because professors and everyone else is using it).

MATLAB's linear algebra operations are really powerful, useful and easy to use. But when it comes to other problems like image processing it is a little bit hard and awkward to solve those problems with linear algebra tools only. I am confused big time. I find myself trying to write very simple things but failing miserably. When I lookup how others have done it it is either too obscure to understand or written very badly (no naming convention, horrible indentation). I feel like I need a paradigm shift in my thinking (I already know about vectorization and how it speeds things up.).

I have the feeling that if I was to write all these things in C++ it would take less time to write.

My question is simple, how can/should I write MATLAB programs? Are there any best-practices, tools, documentation that make easy to move from Java (OOP world in general) to MATLAB?

nimcap
  • 10,062
  • 15
  • 61
  • 69
  • 1
    Could you ask a specific question about a specific problem you're having? Something this vague is likely to get closed, quickly. – Matt Ball Nov 09 '10 at 18:18
  • 1
    This is quite vague, and basically a duplicate of this: [Getting Started with MATLAB?](http://stackoverflow.com/questions/3998472/getting-started-with-matlab) – gnovice Nov 09 '10 at 18:24
  • 2
    I did not like this question either, let's close it – nimcap Nov 09 '10 at 18:55
  • just use it without thinking too much, like most people do whose code you have seen. Or think about MATLAB as just an emulation of a pocket calculator on PC. – Mikhail Poda Nov 09 '10 at 18:56
  • @nimcap: I agree with you, it easily inflammable! – Mikhail Poda Nov 09 '10 at 18:58
  • @Mikhail: Only 1 more vote is needed, why don't you vote? – nimcap Nov 09 '10 at 19:05
  • 2
    @nimcap: If indentation is bad, ctrl+A followed by ctrl+I will solve the issue. – Jonas Nov 09 '10 at 19:15
  • This sounds like a good question for Programmers. If you move it there, I can try to give you some pointers. – Dima Nov 09 '10 at 19:20

1 Answers1

3

There is no reason to abandon good practices! Stay with your naming conventions and formatting. Use unit testing while coding your classes. There has been a significant improvement in the object model recently.

Another MATLAB power feature is JAVA scripting. Just import your well known libraries and instantiate classes to call there methods. Even The MathWorks is using this approach. Look at the implementation of urlread for example.

edit urlread


Often lines of code may be reduced by knowing the 'right' function. Sometimes even at the cost of readability.

As MATLAB is often used by engineers with little to no training in software development, code quality may suffer. With respect to solving 'technical' problems, MATLAB is a great tool.

zellus
  • 9,617
  • 5
  • 39
  • 56