What are the thought processes that go on when you are trying to solve a MATLAB problem?

3 views (last 30 days)
I am (fairly) new to MATLAB, just started using it more heavily these past few months (before then I just used it to make basic plots). So when I have an issue I typically spend hours on just the (seemingly) simplest things such as how to remove certain values from structures and how to improve image quality for image analysis etc...
I just wanted to know if there is a particular thought process that you (everyone) go though before finding a solution to your exact problem. This might sound like a pretty dumb question but I think maybe learning about how other people tackle code related problems may be able to help me add good habits to what I do and make me improve.
Manny Kins
Manny Kins on 2 May 2019
Hi Stephen, thank you it is very reassuring knowing that spending a lot of time learning and progressing. I guess it can be frustrating trying to solve something when you don't have the right "toolkit" in your repertoire so learning and trying to implement the documentation will do me a lot of good. The link had extremely valuable information which I will try and take on board, thanks for your time.

Sign in to comment.

Accepted Answer

Adam on 2 May 2019
Edited: Adam on 2 May 2019
I make very heavy use of the debugger, in combination with the command line to try out syntax and options. I also often like to create quick scripts to test out alternative solutions to a problem where speed is an issue and I want to understand which is fastest.
I make heavy use of the offline documentation, using e.g.
doc ismember
or whatever function I want to use, looking at the 'See Also'; section or any other links from the page if the function itself is not what I want, but I feel I need something similar.
I keep a series of e-mails (effectively a blog, but for reasons not interesting here, e-mails were the chosen medium) in which I write up what I call 'Matlab Nuggets' which remind me (and my other team members, who I also send them to) about certain functions or how I solved a certain problem or reusable code I added to our repository. Basically just anything I think I or my team may find useful in future that i can search for.
Our team also has a fairly large repository of past code now so if I know I have solved a similar problem (or part of it) before I will do a search in our repository to find the relevant code if I can.
I also use other sources such as Matlab Answers and Yair Altman's Undoucmented Matlab blog, although this tends to be more hardcore! One of the main reasons I started answering questions on Matlab Answers is because it helps me learn. So many people post questions that can easily be answered just by testing out some syntax on command line - apparently they don't think of that, but me doing it and providing the answer they could just have easily found themselves helps various concepts or syntaxes sink into my brain too for future usage.
Stephen23 on 2 May 2019
Edited: Stephen23 on 2 May 2019
"The part where you mentioned to keep improving code that is slow really hits home..."
This is also one of the hardest parts of being responsible for some code, because at some point you will have the choice: either improve/update that code and make it incompatible with existing data/functions (and make all of its users quite grumpy) or stick with some slower, buggier version (and make all of its users quite grumpy). There is no way to avoid this, it will happen:
The best solution is to use best-practice as much as you can (or is reasonable for your needs): keep track of code versions (best: with a version system), encapsulate functionality in functions or classes with clearly defined interfaces, keep data together as much as possible, etc..

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!