# MATLAB Spoken Here

## What’s new on File Exchange

As David Garrison explained in his earlier post on the Art of MATLAB blog, MATLAB Apps are a great way to extend your MATLAB functionality.  File Exchange now makes it easier to search and browse for MATLAB Apps created by the community.

You’ll see two new showcase areas on File Exchange, one for MATLAB Apps and another for MATLAB Examples:

Exploring Featured MATLAB Apps, I was interested to try S B’s All-purpose mortgage calculation tool.  Having myself once developed a mortgage analysis and underwriting tool for income-producing commercial real estate, S B’s MATLAB code seems to do a good job demonstrating the financial concepts as apply to the residential market.

Once you click “Apps” from File Exchange, you will be prompted with the Content Type “app” already filtered in your search box.  Browsing the Apps facet on File Exchange,

 I discovered Ameya Deoras’ App, Graphical tool for exploring the Black-Scholes-Merton Option Pricing Model. This would have been great to have when I was studying the model in school, and I imagine it will be a good basis for extending the model further. On a lighter note, you can also find Stellaria, “The best MATLAB shooting game ever”.  It’s a good example, by Mingjing Zhang, of the breadth with which MATLAB can be applied.  It’s great to have fun with MATLAB, and I especially enjoyed looking through the code. There are also many useful MATLAB Examples on File Exchange.  I particularly liked the Customizable Heat Maps, also by Ameya Deoras.

It would be great to see what you’ve found valuable.  Have you used File Exchange on your path to solving challenging problems?

Thanks,
Bob

## MATLAB communities all around the world

Most regular readers of this blog are members of our MATLAB Central community. Here you can find great resources like MATLAB Answers, File Exchange, Cody and our MATLAB blogs to help you find answers to your MATLAB technical questions and develop programming skills.

Did you know that there are people all over the world talking about MATLAB? This discussion by users on MATLAB Answers made me think about our users all over the world. I thought I would share links to a few sites that might be of interest to our MATLAB users.

# Links shared by community members

Here are the links that our community members shared in MATLAB Answers:

Here are a few other communities that I know of:

Do you have any other places where you hang out to talk about MATLAB programming? Share your thoughts as a comment below.

## September 25th, 2012

I was reviewing user questions the other day, comparing how users ask questions about MATLAB within different parts of our community. The areas that I looked at were:

I was impressed by how many community members are out there sharing their questions and insights about MATLAB. Every day there are hundreds of discussions between users of widely varying technical knowledge and skills. Thank you to everyone who has made our community conversations such warm and vibrant places to hang out!

There are also quite a few folks asking questions but not getting the answers they seek. So I thought I’d take a moment to share some of my favorite pointers within the community on how to ask questions. Although these suggestions come from MATLAB Answers, the advice is universal. It can be applied to your questions regardless of whether they are asked online or even face to face.

In the MATLAB Answers About page, there is a section that offers guidance on how to ask good questions and how to write good answers. Here is a quick tip list that you might find helpful if you are new at asking questions in the community.

If you learn best by reading tutorials, you should look at Oleg Komarov’s tutorial. In his tutorial, Oleg overviews how to find answers before asking questions, dos and don’ts on writing questions, examples, and best practices on following up with questions.

### Community input

Ned asked the community to share their thoughts about what goes into a good question. Check out advice from different members of our community who have answered many of your questions over the years.

Often students ask questions about their homework assignments. Doug Hull wrote a post to help students understand how to get help with their homework. Several community members also shared pointers as comments to this post.

Do you have a favorite style of asking technical questions that you find connects well with people who can answer your questions? If so, share them with us by posting a comment.

## How do you use MATLAB Answers?

In a little over a year and a half, the MATLAB Answers community has:

• Posted tens of thousands of questions, answers and comments, with an average of 75 to 100 new questions being added every day.
• Turned Answers into the fastest growing area of the MathWorks website.
High fives all around—our work is done!
Well, not really.

While we’re positively gobsmacked by how the community has embraced and shaped Answers into what it’s become, we needed to understand what we had done right. And more importantly how we could continue to build on it.

We had lots of questions, but essentially we wanted to know: 1) why are people coming to Answers, and 2) how are they using it? In June, I had a chance to ask those questions directly to several active members of the community during individual phone interviews.

The first question attempted to get at people’s motivations for initially coming to Answers—and their subsequent decision to keep coming back. Two related factors came up as key motivators: 1) to improve their skills, and 2) to share their skills.

Improve their skills

Whether it’s a novice using MATLAB for the first time or a power user refining their skills, people come to Answers to learn. One person said Answers was a way to, “keep my skills fresh” and that it provided a “source of ideas of useful things to do.”

In response to how people are using Answers to improve their skills, another user described how it helped them learn Simulink. As a skilled MATLAB user, they were less familiar with Simulink. By looking at Simulink posts, they began to see how other people used the product and gained some initial insights into the system logic. In addition to being able to ask questions of the community, they could compare their skill set to others and gauge the amount of progress they had made. Gaining confidence in their newfound abilities, they began answering questions; when no one corrected or amended their answers, they interpreted it as validating their knowledge—a form of peer review.

Share their skills

Having reached a level of proficiency, some interviewees are motivated to share their knowledge with the community. As one person said, “I had questions and I received some answers; I think I should give that back.” This sentiment of ‘giving back’ to the group was expressed by several interviewees.

In terms of how the community are sharing their skills in Answers, one individual expanded the idea of ‘giving back’ by informally mentoring people: “If I have a good interaction with somebody that I’ve answered a question for, I’ll go and check and see if they have any other questions that they’ve asked and see if I can help out with any of the other ones.” By actively ‘following’ a questioner, they sought to “provide that user with a little more help…that they might not have gotten before.”

The exchange of information, tips and tricks among active MATLAB and Simulink users is at the heart of MATLAB Answers popularity. As one person pointed out: “You might have your experts there [at MathWorks], but there are far more out here.”

We couldn’t agree more. Community experts have been the engine behind the success of Answers. Stories such as the two highlighted here give us insights into the needs of the community. By understanding how you’re using it, we can continue to improve  MATLAB Answers.

## Try this on Cody and Trendy

Hi, I’m Bob Levy and I’ve recently joined the MATLAB Central team as Product Manager. I’ll be writing here periodically to help keep you up-to-date on what’s new on MATLAB Central.

A product manager’s main job is to guide focus so that we’re developing what’s needed most. But how do we know? A primary source is to hear from you directly. Your input will help us make MATLAB Central even more valuable, so please reach out at bob.levy (at) mathworks.com with your feedback and suggestions.

For this first post I’ll offer some initial observations and ideas,

Cody

Clearly an exciting area, since launch earlier this year did you know over:

• 5,931 community members have played Cody,
• submitting over 100,000 scored solutions, and
• contributing over 500 Cody problems to challenge their peers!

It’s remarkable to see such a highly skilled community with members such as yourself. Bravo!

Have you considered using Cody as a way to tap into the collective expertise of your MATLAB Central peers in a more profound way? What innovation and collaboration could you spark by posing technical computing challenges in the form of Cody problems? Try it this way and see if the community can help you discover breakthrough new thinking for your toughest problems.

Trendy

Web-based plots which don’t become obsolete. It’s an exciting concept bloggers and site owners among us will value. Embed a Trend Plot to make your work online timeless. We of course appreciate and encourage your linking plots back to the source page on Trendy so others can benefit as you have.

For example, I recently became interested in automotive depreciation because I didn’t want to buy too new a car and lose a lot of money the moment I drive off the lot. My objective was to see at what model year I’d best minimize exposure to depreciation while balancing my needs, in this case looking at the BMW z4. It was easy to create a Trend Plot in Trendy for that:

Over time, the plot will update itself as more data becomes available, no further action required on my part.  I did not need to engage in elaborate software development, I simply described the data (a.k.a. trend) in terms of a website where this data is available and updated online.  Then, using familiar MATLAB statements, I described the plot I wanted above.  Trendy does the rest.

What I didn’t expect, but was pleasantly surprised to see, is a trend is emerging which I’m hopeful informs of the best time of year to purchase. Stay tuned at this page to see as this unfolds.

You’ll also notice, Trendy now makes it possible to sort by # of Likes, so you can more readily find the most liked plots quickly.

I look forward to hearing from you, and to seeing your cool new Trend Plots and your MATLAB prowess demonstrated and grown as you play Cody!

## Learn about MATLAB Plots using Trendy

The other day I was looking at questions from our users on MATLAB Answers, the MATLAB Central Newsgroup and also on MATLAB’s Facebook page. I saw quite a few posts asking questions about ways to enhance MATLAB plots. When I am trying to learn something new, I always learn better if I can see how others have done it, so I thought it would be fun to would share some plots from Trendy that show basic things you can do. Remember that Trendy lets you click on the “Show/Hide Code” button to see the code the author used to create the plot.

Let’s take a look at some examples of plots…

### Using Data Markers

In How many MATLAB jobs in South of France, Aurelien is showing a simple chart using Trendy defaults. Notice that data points in the chart are represented by an ‘o’.

In this next trend, Rob Nickerson has created a simple chart with a different look by removing the data point markers from his plot code and making the lines thicker. Also notice that he has added a label on the y-axis using the ylabel command. He has also kept the chart legend from interfering with his chart by relocating it near the y-axis.

### Changing Plot Colors

In Ned Gulley’s trend Temperatures in Anchorage and Honolulu, notice that he has a similar plot charting two different pieces of data. But if you look at his code, you can see how he easily changed the colors in his plot command.

If you’ve been checking out Trendy at all, you’ve probably seen Hugo Carr‘s Hysteriometer which is “a measure of the total expressed fear and outrage from newspaper tabloids in Britain benchmarked against their more moderate counterparts”. (See reference in the British paper, the Independent “Calm down, dears“.) What you might not have noticed in the plot is how Hugo has controlled the colors used in the plots using ColorOrder, which is a pretty handy feature.

### Putting Multiple Plots in One Graphic

One last plot I’d like to share with you is, again, by Aurelien. In MathWorks should have an office in my village, he’s taken the plot we saw in the earlier example. He’s used the subplot command to combine it with a second plot, creating a single graphic. It is a good visual technique to compare data while conserving whitespace on your page.

## Mastering MATLAB Markup

In my completely biased opinion, one of the most useful features in Cody, Trendy, and MATLAB Answers is the ability to use MATLAB Markup to format text. Formatted code blocks, embedded links, and emphasized text, as used in Matt’s uicontrol answer and @bmtran’s description of his popular n-dimensional multiplication problem, really help readers understand what’s going on in the post.

### MATLAB Mark-What?

If you haven’t used these applications, MATLAB Markup is an easy way to format plain text for conversion to HTML. For example, you might type:

To *boldly* go...

This is converted to HTML:

To <b>boldly</b> go...

and displayed looking nice and polished:

To boldly go…

### The Secret Identity of MATLAB Markup

Plain-text-to-HTML markup languages are nothing new. Wikipedia is built with one. I’ve been known to write my grocery lists in Markdown. And MATLAB Markup has a well established ancestor: the text markup used in the MATLAB publish tool.

Check out the n-dimensional Cody question (linked to above), ready for MATLAB to publish as HTML. Note the asterisks for bold and underscores for italic.

### Tips and Tricks

#### 1. Remember to insert blank lines above and below paragraph markup

Blocks of code, images, and bulleted or numbered lists require a blank line above and below the markup. While this markup doesn’t work:

A familiar plot: <<http://mathworks.com/matlabcentral/images/surf.gif>> 

this markup does:

A familiar plot:

<<http://mathworks.com/matlabcentral/images/surf.gif>>

#### 2. Nest markup as needed

The convention on MATLAB Answers for linking to MathWorks documentation illustrates the usefulness of combining markup. Answerers are encouraged to format links with the name of the function in a monospaced font: publish. In MATLAB Markup, this looks like:

<http://www.mathworks.com/help/releases/R2012a/techdoc/ref/publish.html |publish|>

#### 3. Use HTML entities when you need to mark up the markup

Sometimes you’ll want to include markup characters while preventing their automatic conversion to HTML. If I typed:

Absolute value is displayed as |abs_val|

I’d get the following output:

Absolute value is displayed as abs_val

Instead of using the pipe character (|), I use the HTML entity &124;. A full list of relevant HTML entities appears on the MATLAB Markup help page.

Absolute value is displayed as &#124;abs_val&#124;

and get the following output:

Absolute value is displayed as |abs_val|

### Resources

If you want to learn more about MATLAB Markup or publishing from MATLAB, here are some great resources:

### What’s Next?

Help make MATLAB Markup more useful. Comment on this post with aspects that trip you up, enhancements you’d like to see, or tips for other users.

## Wait bars and beyond: call me when you’re done

Here’s a fun fact: the File Exchange contains nearly 70 different implementations of the wait bar (or progress bar, as it’s sometimes known). Stop and consider that number for a moment. It’s staggeringly large, especially when you consider that MATLAB already has a wait bar function.

Why do you suppose so many people have taken the time and trouble to submit yet another wait bar? What message is the File Exchange trying to send us?

I can offer a few guesses. Making a wait bar is a fun little project. It’s not too hard. And there are plenty of interesting variations on the basic theme: multiple wait bars, shiny wait bars, wait bars that tell you how much longer you’ll have to wait, ASCII wait bars for the command window. Wait bars with controls. There’s even a fake wait bar (From the description: Use it to show your boss that you can’t work at the moment because systemload is 100% and the calculations will take some time!). But the most important thing is that fact that wait bars are useful. They are useful because people love to make MATLAB sweat. Long computations mean a lot of time staring at the screen wondering when the iterations are going to stop. That gives you a lot of time to think about that cool new version of waitbar.m that you’re going to submit to the File Exchange.

I’ve done my share of waiting for MATLAB, and I’m here to tell you that I have the perfect enhancement for all those wait bars. I think the best wait bar is not one that makes you stare at a slowly growing progress bar. The best wait bar is one that lets you sip a cup of coffee and work on a crossword puzzle, and then texts you when it’s done.

How might we build such a thing?

Fortunately, as the world gets more mobile, it’s getting easier to find cheap, simple services to help you stay connected. I’ll describe one here, but there are others like it. I recently learned about a web service called Pushover. Pushover is platform for sending notifications to mobile devices. It’s essentially the same as text messaging. What makes it different from texting, though, is how easy it is to send a notification. All you need to do is send an HTTP POST request to their server.

How do you send a POST request from MATLAB? MATLAB Central to the rescue! Here’s a thread from the Newsreader in which Matthew Simoneau addresses this very question. It turns out all you need is MATLAB’s built-in URLREAD function.

Putting it all together, here’s what you need to do to add mobile notifications to your wait bar with Pushover: Get the app, get an account with them, register an app (MATLAB), register your device, and then make this call from MATLAB.

% Pushover Demo

userKey    = 'xxxxxxThisIsYourUserKeyxxxxxxx';
appToken   = 'xxxxxxThisIsYourAppTokenxxxxxx';
deviceName = 'iPhone';
msgTitle   = 'Calculation complete...';
msgText    = 'Now stop drinking coffee and get back to work!';

params = { ...
'token',   appToken, ...
'user',    userKey, ...
'device',  deviceName, ...
'title',   msgTitle, ...
'message', msgText};



Easy-peasy, eh?

Now leave a comment for us. Would you use wireless notification in conjunction with MATLAB? Also: I want to hear why you think there are so darned many wait bars.

## MATLAB Central Community Freshens Up MathWorks Support Site

• Attention-grabbing graphics

• Rotating spotlights featuring latest news, reminders, and technical articles
• An area dedicated to community activities

This new area rotates tabbed views highlighting none other than… you guessed it… you! That’s right – our MATLAB Central Community is helping to keep the main MathWorks Support page current, informative, and helpful.

Content featured in these tabbed views includes recent Community Answers,
highly rated submissions on File Exchange, and

blogs sharing chatter from MathWorkers.

So, what’s hot in the Support world? You are! Way to go!

The support experience wouldn’t be complete without the vast resources provided by members of our community.  You all are a valuable part of that experience. Keep those great submissions and answers coming!

As always, we welcome any feedback you may have on the updated site.

## Lose the Gray Face: Customize Your Profile

Do you have a picture on your Community Profile?  If you don’t, customize your Community Profile for a chance to win a MATLAB Central hat and t-shirt.

While writing about the Cody milestones a couple weeks back, I was looking at the Players page and thinking it would be great if we could get more community members to personalize their profile and add a picture. This is a great way to connect with other community members and receive recognition for all your contributions on MATLAB Central.

If you look at Ned’s Trendy plot, it shows custom picture trends for MATLAB Central. As you can see, a lot profiles don’t have a picture, which means we have a lot of not-so-fun gray silhouettes on MATLAB Central.

When a community member navigates to your contributor/player page to see all the contributions you’ve made on MATLAB Central, this is the not-so-fun gray silhouette they will see.

By the way, my profile does have a picture, I just didn’t want to pick on anybody specific. And thanks to Alfonso, there is one fun gray silhouette!

Here are two great examples, take a look at Matt Fig’s  and Nickolas Cheilakos’ community profile. These community members have nailed it, by including an interesting picture and their interests in their profile.

It’s easy to customize your profile and add a picture, just navigate to the Community Profile page and click Edit My Profile.  To make it even easier for you, here’s the shortcut to edit your community profile. While you’re there, don’t forget to update your Personal Profile and add your Professional Interests too.

So this week I challenge you to customize your community profile for a chance to win a MATLAB Central hat and t-shirt. On Monday, August 6, 2012, I’ll randomly pick a winner and send out the prize.

UPDATE Aug 8, 2012:

We have a winner – Congratulations to Stuart! You have a MATLAB Central hat and t-shirt coming your way. Thank you to everyone who updated their Community Profile.

News from the intersection of MATLAB, Community, and the web.

These postings are the author's and don't necessarily represent the opinions of MathWorks.