# File Exchange Pick of the Week

## Generate a Smile…Maybe

Brett's Pick this week is "Random Face Generator", by Joseph Hollmann.

I wrote today's post in advance. I fully expect that, when this goes live on Friday morning, I will be sitting on a tropical beach in the Dominican Republic, sipping umbrella drinks and contemplating the crystal clear cerulean water.

So, in the spirit of Spring Break and focusing on family fun, a bit of frivolity for today's Pick.

Joseph's submission doesn't really do anything of a practical nature, but it does make you smile. As he says in the preamble to his code, randomfacegenerator "generates a randomly created face and plots it....nothing else."

I have one suggestion for improvement. Calling the figure command in the function is probably unnecessary; you can easily end up with many open figures before you know it. I would suggest replacing the lines:

figure;
set(gcf,'name','Your New Face');

with a call to togglefig:

togglefig('Your New Face')

(That is, if a figure named "Your New Face" exists, activate and reuse it. Otherwise, create it.) No inputs required:

while ~strcmp(get(gcf,'currentcharacter'),'s')
randomfacegenerator
pause(0.5);
end

Thanks for putting me in vacation mode a day early, Joseph!

As always, I welcome your thoughts and comments. Or leave feedback for Joseph here.

Get the MATLAB code

Published with MATLAB® R2013a

### 4 Responses to “Generate a Smile…Maybe”

1. Joseph Hollmann replied on :

Brett,
It took me a while to realize this was my submission. Thank you for the comments. I actually updated my code but never got around to updating the file exchange. I will do that now. I hope you have a great vacation.

cheers,
Joseph

2. Amro replied on :

You could make the function more practical for multivariate data visualization (similar to [Chernoff faces][1]) by parameterizing the face “features” instead of generating them at random. Statistics toolbox has a similar functionality with [glyphplot][2]

3. Rameh replied on :

Function ‘togglefig’ is not working on my matlab 2009. So plz tell me how to fix it?

4. bshoelso replied on :

@Rameh:
Can you tell me more about how it’s failing? (I assume that you noticed that the word “togglefig” is a hyperlink, and that you installed the function and made sure it’s on your MATLAB path, yes?)
Brett

Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

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