Oftentimes in the course of coding, I find myself with little bits that I don’t want to deal with right away–things that I would like to come back to them later. Like most IDEs, MATLAB allows you to drop annotations which indicate things to do, fix, or otherwise note for later.
By adding a comment with the text: “TODO” or “FIXME” in a MATLAB file, you automatically sign up for this feature. You can then use the TODO/FIXME report to scan all the files in a given directory for these tags, which presents the results to you in the web browser.
You can get to this report using the directory reports-drop down in the Current Directory Browser:
Clicking on the TODO/FIXME report button will cause MATLAB to scan all the files in the current directory, and display each line in the files that have one of the keywords. For example, in my directory I have two files with applicable markers:
You’ll notice that the report also picked up a line with a “NOTE” in it. As an added bonus, we can find up to one additional comment tag, “NOTE” by default, but you can enter whatever regular expression you desire. To specify your own custom tag, replace the text in the text field that reads “NOTE” in the TODO/FIXME report web page (see above screen shot) with your own regular expression.
In general, I recommend using these comments as quick reminders for changes you really, really will work on in the near future. I’ve found such notes lose meaning when viewed by others or even yourself when revisiting the code after it is no longer fresh.
6 CommentsOldest to Newest
A few months ago, I attempted to use this feature for the first time, but couldn’t remember what the key word was to make a “To Do” or “Fix Me” entry. I spent ~20 minutes surfing the documentation and found good documentation about how to generate the report, after I had populated the code with the appropriate key words followed by my meaningful text.
I called your technical support and it took them ~10 minutes to answer it.
I’ve just glanced at the help system and it appears that this release retains that poor documentation about how to actually make a “To Do” entry. Am I right?
Hi Mike, I think this feature is great… if all your code is in one directory! I cannot fathom why the designers of this feature did not support subdirectories. If the report had options to include all subdirectories (or even custom paths) it would be useful. As it is, I would have to go through a manual process directory by directory to find all the TODOs, which makes it useless for me and probably many others.
Similarly, the MATLAB philosophy seems to be to allow everything to be achievable from m-code but only 95% of the time. It would be good to be able to do this kind of report from m-code. Of course that’s not too hard by writing your own but the flexibility to have these reports auto-generate would be good.
Thanks for the feedback. We’re always looking to make our tools easier to use and more discoverable.
Including subfolders is on our radar as a future enhancement for all the reports. You can bring up the Todo/Fixme report for the current folder with the DOFIXRPT command.
Is it somehow possible to run reports not only on files in current folder, but also including all subfolders?
There’s no way to do this currently.
It would be great if this enhancement “run report recursively” was submitted to dev team. I guess it is already done?