MATLAB Community

MATLAB, community & more

New Features: How Do You Find the Good Stuff?

If I give you something but you never get the news, did I really give it to you?

This happens all the time with MATLAB features. We hear from someone who says, "Why doesn't MATLAB have a way to do X?" and we say something like "That feature has been shipping for two years." Sometimes this makes people happy, and sometimes it makes them very grumpy. Either way, they had to suffer through a period where they needed X and didn't have it. And that's unfortunate.

What's the solution? You can read the release notes. This page is pretty handy for showing you what's new between any two releases. MATLAB R022b just came out, and it has 112 notes associated with it. That's a lot to sift through, so you can be forgiven for not wanting to read the release notes for every version. But you might get lucky and have something like the dictionary feature catch your eye on the Release Notes page.

Community is one of the best ways to keep up with what's new and useful. My favorite way to discover new stuff is to have a well-informed friend who fills you in from time to time. We don't all have such a friend, so blogs are also good for discovery. Let Mike Croucher be your clever friend who tells you about, for example, the dictionary feature in his MATLAB blog.

An introduction to dictionaries (associative arrays) in MATLAB » The MATLAB Blog.

You'll often find discussion of new features on the blogs during "release season." For MathWorks, release season is early March (R20XXa) and early September (R20XXb).

But really, you don't always care about what's new. You care about what's new to you, even though it might be very old. This happens because you don't care about a feature until the moment you need it, and at that moment you're too busy building something. This is the teachable moment where, ideally, your friend the MATLAB expert happens to walk by and say, "Oh wow, you should totally use datetime for that."

In that spirit, I'm not going to tell you about new features today. I'm going to tell you about some older three-star features. What do I mean by three stars? The Michelin Guide gives stars to restaurants with this explanation.

Michelin Stars
1 star : A very good restaurant in its category.
2 stars : Excellent cooking, worth a detour.
3 stars : Exceptional cuisine, worth a special journey.

Ned's Stars
1 star. Worth knowing about. "Hmmm. Might be useful someday."
2 stars. Worth writing some code to play around with it. "That's cool!"
3 stars. Worth re-writing a lot of old code to simplify it. "Wow. Wish I had this last year."

Here are three features from recent years that were such big improvements to MATLAB that I went back and rewrote old code. It made me so happy to clean it up.

  • datetime. If you've spent ages bouncing around between datenum, datestr, and datevec, it's time to meet datetime. You'll be so much happier.
  • tables and timetables. Tables are old news by now, but if you haven't started using them in your code, you're really missing out. Particularly if you deal with time series data; timetables are a delight. You can bring your tables in directly from data files with the Import Data UI. Get rid of all those fiddly sscanfs and textscans.
  • arguments. Some functions just sound funny. On this basis, I always liked nargin and nargout. They remind me of Tweedledum and Tweedledee, standing guard at the entrance of a function. But they're a pain to work with, and they lead to ugly code. Use the arguments command and everyone will be better off.

Sometimes old news, when it's new to you, is the best news. What function changed your code, once you finally got around to properly learning it? And remember, since you're the kind of person who reads things on MATLAB Central, you are somebody else's clever MATLAB friend. What three-star function should you be telling your friends about?

|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。