Developer Zone

Advanced Software Development with MATLAB

Driving Productivity … Without Losing Control

Hi all, today I'd like to turn the time over to Matt Tearle from our Training Services group who has a great story to share about how two different MATLAB code workflows "just work" together to make an even more powerful flow. We'd all do well to learn from Matt, he is passionate about MATLAB and is constantly finding new ways to leverage its power. Take it away Matt!

The goal: develop anywhere

Don't you hate it when you're trying to figure out why your algorithm isn't working but you have to attend a meeting, or pick up your kids, or get to a dentist appointment? But then as you're sitting there waiting for the dentist to examine your X-rays, you realize that you forgot to rescale z before interpolating. It's a simple fix. You could do it right now, in a few seconds... if only you had (a) MATLAB and (b) your files.

MATLAB Online and MATLAB Mobile give a solution to (a), but what about (b)?

This kind of scenario is why I love MATLAB Drive. It's a cloud storage system for your files - similar to Dropbox or Google Drive - but with the important added benefit that it integrates seamlessly with MATLAB Online/MATLAB Mobile. In fact, your file system in MATLAB Online is MATLAB Drive. This means you don't have to mess about getting your files from your chosen cloud storage system to MATLAB Online.

I have installed the MATLAB Drive client on all the computers I use regularly for MATLAB. If I happen to be using MATLAB on another machine, I can access my MATLAB Drive files online. And if I'm on a machine without MATLAB, or I'm using a mobile device, I can use MATLAB Online or MATLAB Mobile. So whichever way I'm doing my MATLAB, I have my files!

MATLAB Drive solves problem (b) and its integration with MATLAB Online and MATLAB Mobile solves both (a) and (b). This, then, gives me the ability to develop from anyway - work, home, the bus, the dentist, my kids' ballet rehearsal (seriously, those things last forever). I now routinely keep most of my personal side-projects in my Drive folder.

A potential problem

But what if I want to do this "anywhere-development" on files that are in my source control folder? For me, this usually means my File Exchange submissions, which I have on GitHub. These files live in a "sandbox" folder on my local drive. I use the built-in MATLAB Git integration to keep this sandbox folder under source control.

I can work on files locally, then integrate to GitHub. But how do I get access to those files from anywhere? That is, how do I get source control and the convenience of MATLAB Drive?

The solution: keep it simple

At first this seemed like it could be complicated. Do I need a source control client on every device? That doesn't seem very convenient. But, generally, I have one main computer that I use to manage the source control; I just need access to files so that I can keep tinkering with them from various locations. In that case, the solution is remarkably simple: keep my local repositories inside my Drive folder.

That is, my sandbox folder is just one of the folders in my Drive folder. Now I can work on my sandbox files from anywhere and any changes I make are replicated through my Drive client. If I want to work on a file at work or at home, the Drive Connector on my work laptop or home desktop synchronizes my changes. If I want to work on a mobile device, I can connect to MATLAB Online and I'm automatically working on my MATLAB Drive files.

The next time I get back to my work laptop, my files are up to date. I can keep working or check them in. Easy.

Making the change was easy, too. I just created a new local sandbox inside my Drive folder, sourced from the existing GitHub repo.

This pulled the files from GitHub into my new Drive/sandbox folder. Then I just deleted my old (non-Drive) sandbox folder. That's one nice aspect of source control in MATLAB: it's easy to make local repos. Having made the change, it's now easy to keep everything new there.

Ready to drive? Go ahead: take control!

Have you avoided integrating MATLAB Drive into your development workflow because you didn't think it would work with source control? If so, give it a try! I hope you will be as pleasantly surprised as I was at how painless it is. Or are you already using MATLAB Drive? If so, please share your experiences and tips in the comments.

Published with MATLAB® R2017b

  • print


To leave a comment, please click here to sign in to your MathWorks Account or create a new one.