<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>File Exchange Pick of the Week</title>
	<atom:link href="http://blogs.mathworks.com/pick/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/pick</link>
	<description>&#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1093599&#38;objectType=author&#34;&#62;Brett&#60;/a&#62; &#38; &#60;a href=&#34;http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1094142&#38;objectType=author&#34;&#62;Jiro&#60;/a&#62; share favorite user-contributed submissions from the File Exchange.</description>
	<lastBuildDate>Fri, 17 May 2013 14:19:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Benchmarking your GPU</title>
		<link>http://blogs.mathworks.com/pick/2013/05/17/benchmarking-your-gpu/</link>
		<comments>http://blogs.mathworks.com/pick/2013/05/17/benchmarking-your-gpu/#comments</comments>
		<pubDate>Fri, 17 May 2013 13:00:14 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4583</guid>
		<description><![CDATA[Jiro's pick this week is GPUBench by Ben Tordoff.Some of you may know of the bench function. It allows you to benchmark your MATLAB on your machine and compare it against other machines. It performs some mathematical computation tests, as well as graphics tests. Note, as mentioned in the documentation, that bench is for comparing [...]]]></description>
				<content:encoded><![CDATA[

<div class="content"><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/34080">GPUBench</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/80363">Ben Tordoff</a>.</p><p>Some of you may know of the <a href="http://www.mathworks.com/help/matlab/ref/bench.html"><tt>bench</tt></a> function. It allows you to benchmark your MATLAB on your machine and compare it against other machines. It performs some mathematical computation tests, as well as graphics tests. <i>Note, as mentioned in the documentation, that <tt>bench</tt> is for comparing a particular version of MATLAB on different machines, not comparing different versions of MATLAB on a single machine.</i></p><p><tt>GPUBench</tt> is <a href="http://en.wikipedia.org/wiki/Graphics_Processing_Unit">GPU</a> version of <tt>bench</tt>. With <a href="http://www.mathworks.com/products/parallel-computing/">Parallel Computing Toolbox</a>, you can perform MATLAB computations on NVIDIA CUDA GPUs with <a href="https://developer.nvidia.com/cuda-gpus">Compute Capability</a> of 1.3 or greater. But your mileage may vary depending on the hardware you have. Sometimes, looking at just the Compute Capability may not be enough to see if one card is better than another for MATLAB computations. <tt>GPUBench</tt> will test your card and compare with other common GPU cards. Here's a sample table that gets generated from the benchmark. It reports in <a href="http://en.wikipedia.org/wiki/FLOPS">gigaFLOPS</a>, so higher the number, the better the performance.</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_gpubench/potw_gpubench_chart.png" alt=""> </p><p>When I bought a MacBookPro last year and noticed that it had a supported GPU card, I ran the benchmark on it and got the following result. <i>Note that this was done with an older version, so the list of cards is a bit old.</i></p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_gpubench/potw_gpubench_mac_chart.png" alt=""> </p><p>The "Host PC" refers to the CPU on my Mac, and "GeForce GT 650M" is the GPU that's equipped. We can see that the GPU seems to outperform the CPU on single-precision computations but not so much on double-precision computations.</p><p>Ben periodically updates the data files to include the newer GPU models that have come out. As of the writing of this post, the version includes benchmark data for K20.</p><p><b>Comments</b></p><p>Do you use GPUs, or are you interested in using GPUs for your work? Let us know about it <a href="http://blogs.mathworks.com/pick/?p=4583#respond">here</a>. If you do GPU computing in MATLAB, give this App a try and leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/34080#comments">comment</a> for Ben.</p><script language="JavaScript"> <!-- 
    function grabCode_8cdb5f2a63b84f52822c3764b182fc31() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='8cdb5f2a63b84f52822c3764b182fc31 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 8cdb5f2a63b84f52822c3764b182fc31';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_8cdb5f2a63b84f52822c3764b182fc31()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
8cdb5f2a63b84f52822c3764b182fc31 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/34080 GPUBench> by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/80363 Ben
% Tordoff>.
%
% Some of you may know of the
% <http://www.mathworks.com/help/matlab/ref/bench.html |bench|> function.
% It allows you to benchmark your MATLAB on your machine and compare it
% against other machines. It performs some mathematical computation tests,
% as well as graphics tests. _Note, as mentioned in the documentation, that
% |bench| is for comparing a particular version of MATLAB on different
% machines, not comparing different versions of MATLAB on a single
% machine._
%
% |GPUBench| is <http://en.wikipedia.org/wiki/Graphics_Processing_Unit GPU>
% version of |bench|. With
% <http://www.mathworks.com/products/parallel-computing/ Parallel Computing
% Toolbox>, you can perform MATLAB computations on NVIDIA CUDA GPUs with
% <https://developer.nvidia.com/cuda-gpus Compute Capability> of 1.3 or
% greater. But your mileage may vary depending on the hardware you have.
% Sometimes, looking at just the Compute Capability may not be enough to
% see if one card is better than another for MATLAB computations.
% |GPUBench| will test your card and compare with other common GPU cards.
% Here's a sample table that gets generated from the benchmark. It reports
% in <http://en.wikipedia.org/wiki/FLOPS gigaFLOPS>, so higher the number,
% the better the performance.
%
% <<potw_gpubench_chart.png>>
%
% When I bought a MacBookPro last year and noticed that it had a supported
% GPU card, I ran the benchmark on it and got the following result. _Note
% that this was done with an older version, so the list of cards is a bit
% old._
%
% <<potw_gpubench_mac_chart.png>>
%
% The "Host PC" refers to the CPU on my Mac, and "GeForce GT 650M" is the
% GPU that's equipped. We can see that the GPU seems to outperform the CPU
% on single-precision computations but not so much on double-precision
% computations.
%
% Ben periodically updates the data files to include the newer GPU models
% that have come out. As of the writing of this post, the version includes
% benchmark data for K20.
% 
% *Comments*
%
% Do you use GPUs, or are you interested in using GPUs for your work? Let
% us know about it <http://blogs.mathworks.com/pick/?p=4583#respond here>.
% If you do GPU computing in MATLAB, give this App a try and leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/34080#comments
% comment> for Ben.

##### SOURCE END ##### 8cdb5f2a63b84f52822c3764b182fc31
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/05/17/benchmarking-your-gpu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colorspaces out the Wazoo!</title>
		<link>http://blogs.mathworks.com/pick/2013/05/10/colorspaces-out-the-wazoo/</link>
		<comments>http://blogs.mathworks.com/pick/2013/05/10/colorspaces-out-the-wazoo/#comments</comments>
		<pubDate>Fri, 10 May 2013 13:00:49 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4556</guid>
		<description><![CDATA[Brett's Pick this week is "Colorspace Transformations", by Pascal Getreuer.For inspiration for this week's Pick, I went back to my post from April of last year, in which I asked readers to suggest files to feature. I started to write up Pascal's submission long ago, but somehow got sidetracked, and I wanted to circle back [...]]]></description>
				<content:encoded><![CDATA[
<div class="content"><!--introduction--><!--/introduction--><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/28790">"Colorspace Transformations"</a>, by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/14582">Pascal Getreuer</a>.</p><p>For inspiration for this week's Pick, I went back to <a href="http://blogs.mathworks.com/pick/2012/04/13/what-is-your-favorite-unrecognized-file-exchange-submission/">my post</a> from April of last year, in which I asked readers to suggest files to feature. I started to write up Pascal's submission long ago, but somehow got sidetracked, and I wanted to circle back around to it.</p><p>File Exchange champ <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/29192">Oliver Woodford</a> casually suggested "a couple of useful ones." (His other selection was featured <a href="http://blogs.mathworks.com/pick/2012/08/17/shaded-error-bars/">last August</a> by Jiro.) Both of his "Picks" are quite useful.</p><p>So, what's so great about this colorspace converter? In particular, I really like the fact that Pascal's code extends the colorspace conversion capabilities beyond those offered by the Image Processing Toolbox, and that Pascal has included C-code (and instructions for calling it via the <a href="http://www.mathworks.com/help/releases/R2013a/matlab/create-mex-files.html">MEX interface</a>) to make them faster.</p><p>Colorspace Transformations facilitates conversion to any of these colorspaces:</p><pre>'RGB'              sRGB IEC 61966-2-1
'YCbCr'            Luma + Chroma ("digitized" version of Y'PbPr)
'JPEG-YCbCr'       Luma + Chroma space used in JFIF JPEG
'YDbDr'            SECAM Y'DbDr Luma + Chroma
'YPbPr'            Luma (ITU-R BT.601) + Chroma
'YUV'              NTSC PAL Y'UV Luma + Chroma
'YIQ'              NTSC Y'IQ Luma + Chroma
'HSV' or 'HSB'     Hue Saturation Value/Brightness
'HSL' or 'HLS'     Hue Saturation Luminance
'HSI'              Hue Saturation Intensity
'XYZ'              CIE 1931 XYZ
'Lab'              CIE 1976 L*a*b* (CIELAB)
'Luv'              CIE L*u*v* (CIELUV)
'LCH'              CIE L*C*H* (CIELCH)
'CAT02 LMS'        CIE CAT02 LMS</pre><p>That's a lot of different ways to represent a color image!</p><p>Whenever I am asked to segment a color image--and trust me, that's pretty often!--my initial thought is to look at the R,G, and B colorplanes individually to understand where the information I'm after lies. I do this so often that I wrote and shared <a href="http://www.mathworks.com/matlabcentral/fileexchange/19706-explorergb">a utility</a> that facilitates this exploration process. (In "Advanced Mode," ExploreRGB shows--in addition to RGB [and R, G, and B]--HSV, YCbCr, and L*a*b* versions of the image. I can often find a single-plane version of the original image in one of these transformed colorspaces that makes the segmentation easy. For instance, if I needed to isolate the central yellow pepper in the "peppers.png" image that ships with the Image Processing Toolbox:</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/peppers.png" alt=""> </p><p>I might consider (ironically) starting from the blue chrominance image (i.e., the second colorplane of the YCbCr representation of the image):</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/bluechrominance.png" alt=""> </p><p>Starting with that image plane:</p><pre class="language-matlab">mask = ~im2bw(img,0.24);
cc = bwconncomp(mask);
stats = regionprops(cc,<span class="string">'Area'</span>);
A = [stats.Area];
[~,biggest] = max(A);
mask(labelmatrix(cc)~=biggest) = 0;
mask = imfill(mask,<span class="string">'holes'</span>);
imshow(<span class="string">'peppers.png'</span>)
showMaskAsOverlay(0.7,mask,<span class="string">'c'</span>);
</pre><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/segmentedPepper.png" alt=""> </p><p>Working in a non-standard colorspace made this segmentation problem easier than it might otherwise have been, and certainly easier than doing it in RGB-space would be.</p><p>(<a href="http://www.mathworks.com/matlabcentral/fileexchange/22108-showmaskasoverlay"><tt>showMaskAsOverlay</tt></a> is a utility I shared for overlaying a transparent mask on an image.)</p><p>Okay, so back to Pascal's file.</p><p>With a little bit of code, I can use "Colorspace Transforms" to examine quickly many additional representations of the original image:</p><pre class="language-matlab">cs = {<span class="string">'RGB'</span>,<span class="string">'YCbCr'</span>,<span class="string">'JPEG-YCbCr'</span>,<span class="string">'YDbDr'</span>,<span class="string">'YPbPr'</span>,<span class="string">'YUV'</span>,<span class="keyword">...</span>
<span class="string">'YIQ'</span>,<span class="string">'HSV'</span>,<span class="string">'HSL'</span>,<span class="string">'HSI'</span>,<span class="keyword">...</span>
<span class="string">'XYZ'</span>,<span class="string">'Lab'</span>,<span class="string">'Luv'</span>,<span class="string">'LCH'</span>,<span class="string">'CAT02 LMS'</span>};
peppers = imread(<span class="string">'peppers.png'</span>);
figure(<span class="string">'color'</span>,<span class="string">'w'</span>);
ax = tight_subplot(numel(cs),4);
ind = 1;
<span class="keyword">for</span> ii = 1:numel(cs)
    newim = colorspace([<span class="string">'-&gt;'</span> cs{ii}],peppers);
    <span class="keyword">if</span> max(newim(:)) &gt; 1
        newim = newim/max(newim(:));
    <span class="keyword">end</span>
    axes(ax(ind));
    imshow(newim,[]);title(cs{ii});
    <span class="keyword">for</span> jj = 1:3
        ind = ind+1;
        axes(ax(ind));
        imshow(newim(:,:,jj),[]);title(sprintf(<span class="string">'%s(:,:,%i)'</span>,cs{ii},jj));
    <span class="keyword">end</span>
    ind = ind+1;
<span class="keyword">end</span>
expandAxes(ax)
</pre><p>(<a href="http://www.mathworks.com/matlabcentral/fileexchange/27991-tight-subplot"><tt>tight_subplot</tt></a> was a previous Pick-of-the-Week.)</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/colorspaceList.png" alt=""> </p><p>Now I have a lot more options at my disposal for segmenting images!</p><p>P.S. I know you can't really see what's happening in those tiny thumbnails*, but then that's the beauty of <a href="http://www.mathworks.com/matlabcentral/fileexchange/18291-expandaxes"><tt>expandAxes</tt></a>; if you were to run the code snippet above, you would be able to click on any of those tiny axes and expand them to full-frame. And you could right-click on any expanded axes to export the image to the Workspace!</p><p>*P.P.S. If your image is large, doing what I just did could be a very bad idea. These aren't really "thumbnails"; even if the visualization is small, each of those image objects has in its <a href="http://www.mathworks.com/help/releases/R2013a/matlab/ref/image_props.html">"cdata"</a> container a full copy of the image it reflects.</p><p>Thank you, Oliver, for the suggestion. And thank <i>you</i>, Pascal, for the very useful submission. Swag on the way to both of you!</p><p>As always, I welcome your <a href="http://blogs.mathworks.com/pick/?p=4556#respond">thoughts and comments</a>. Or leave feedback for Pascal <a href="http://www.mathworks.com/matlabcentral/fileexchange/28790#comments">here</a>.</p><script language="JavaScript"> <!-- 
    function grabCode_b7763c2fc1234b029827c0f68bbf81b4() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='b7763c2fc1234b029827c0f68bbf81b4 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' b7763c2fc1234b029827c0f68bbf81b4';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_b7763c2fc1234b029827c0f68bbf81b4()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
b7763c2fc1234b029827c0f68bbf81b4 ##### SOURCE BEGIN #####
%% Colorspaces out the Wazoo!
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/28790 "Colorspace Transformations">, by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/14582 Pascal Getreuer>.

%%
% For inspiration for this week's Pick, I went back to <http://blogs.mathworks.com/pick/2012/04/13/what-is-your-favorite-unrecognized-file-exchange-submission/ my post>
% from April
% of last year, in which I asked readers to suggest files to feature. I
% started to write up Pascal's submission long ago, but somehow got
% sidetracked, and I wanted to circle back around to it.

%%
% File Exchange champ <http://www.mathworks.com/matlabcentral/fileexchange/authors/29192 Oliver Woodford> 
% casually suggested "a couple of useful ones." (His other selection was featured 
% <http://blogs.mathworks.com/pick/2012/08/17/shaded-error-bars/ last August>
% by Jiro.) Both of his "Picks" are quite useful.

%%
% So, what's so great about this colorspace converter? In particular,
% I really like the fact that Pascal's code extends the colorspace conversion
% capabilities beyond those offered by the Image Processing Toolbox, and
% that Pascal has included C-code (and instructions for calling it via the
% <http://www.mathworks.com/help/releases/R2013a/matlab/create-mex-files.html MEX interface>)
% to make them faster. 

%% 
% Colorspace Transformations facilitates conversion to any of these
% colorspaces:
%
%  'RGB'              sRGB IEC 61966-2-1
%  'YCbCr'            Luma + Chroma ("digitized" version of Y'PbPr)
%  'JPEG-YCbCr'       Luma + Chroma space used in JFIF JPEG
%  'YDbDr'            SECAM Y'DbDr Luma + Chroma
%  'YPbPr'            Luma (ITU-R BT.601) + Chroma 
%  'YUV'              NTSC PAL Y'UV Luma + Chroma
%  'YIQ'              NTSC Y'IQ Luma + Chroma
%  'HSV' or 'HSB'     Hue Saturation Value/Brightness
%  'HSL' or 'HLS'     Hue Saturation Luminance
%  'HSI'              Hue Saturation Intensity
%  'XYZ'              CIE 1931 XYZ
%  'Lab'              CIE 1976 L*a*b* (CIELAB)
%  'Luv'              CIE L*u*v* (CIELUV)
%  'LCH'              CIE L*C*H* (CIELCH)
%  'CAT02 LMS'        CIE CAT02 LMS

%%
% That's a lot of different ways to represent a color image!

%%
% Whenever I am asked to segment a color imageREPLACE_WITH_DASH_DASHand trust me, that's pretty
% often!REPLACE_WITH_DASH_DASHmy initial thought is to look at the R,G, and B colorplanes
% individually to understand where the information I'm after lies. I do
% this so often that I wrote and shared
% <http://www.mathworks.com/matlabcentral/fileexchange/19706-explorergb a
% utility> that facilitates this exploration process. (In "Advanced Mode,"
% ExploreRGB showsREPLACE_WITH_DASH_DASHin addition to RGB [and R, G, and B]REPLACE_WITH_DASH_DASHHSV, YCbCr, and
% L*a*b* versions of the image. I can often find a single-plane version of
% the original image in one of these transformed colorspaces that makes the
% segmentation easy. For instance, if I needed to isolate the central
% yellow pepper in the "peppers.png" image that ships with the Image
% Processing Toolbox:

%%
% 
% <<http://blogs.mathworks.com/pick/files/peppers.png>>
% 

%%
% I might consider (ironically) starting from the blue chrominance image
% (i.e., the second colorplane of the YCbCr representation of the image):

%%
% 
% <<http://blogs.mathworks.com/pick/files/bluechrominance.png>>
% 

%%
% Starting with that image plane:
%
%   mask = ~im2bw(img,0.24);
%   cc = bwconncomp(mask);
%   stats = regionprops(cc,'Area');
%   A = [stats.Area];
%   [~,biggest] = max(A);
%   mask(labelmatrix(cc)~=biggest) = 0;
%   mask = imfill(mask,'holes');
%   imshow('peppers.png')
%   showMaskAsOverlay(0.7,mask,'c');

%%
% 
% <<http://blogs.mathworks.com/pick/files/segmentedPepper.png>>
% 

%%
% Working in a non-standard colorspace made this segmentation problem
% easier than it might otherwise have been, and certainly easier than doing
% it in RGB-space would be.

%%
% (<http://www.mathworks.com/matlabcentral/fileexchange/22108-showmaskasoverlay |showMaskAsOverlay|> is a utility I shared for overlaying a transparent mask on an image.)

%%
% Okay, so back to Pascal's file.

%%
% With a little bit of code, I can use "Colorspace Transforms" to examine
% quickly many additional representations of the original image:

%%
%   cs = {'RGB','YCbCr','JPEG-YCbCr','YDbDr','YPbPr','YUV',...
%   'YIQ','HSV','HSL','HSI',...
%   'XYZ','Lab','Luv','LCH','CAT02 LMS'};
%   peppers = imread('peppers.png');
%   figure('color','w');
%   ax = tight_subplot(numel(cs),4);
%   ind = 1;
%   for ii = 1:numel(cs)
%       newim = colorspace(['->' cs{ii}],peppers);
%       if max(newim(:)) > 1
%           newim = newim/max(newim(:));
%       end
%       axes(ax(ind));
%       imshow(newim,[]);title(cs{ii});
%       for jj = 1:3
%           ind = ind+1;
%           axes(ax(ind));
%           imshow(newim(:,:,jj),[]);title(sprintf('%s(:,:,%i)',cs{ii},jj));
%       end
%       ind = ind+1;
%   end
%   expandAxes(ax)

%%
% (<http://www.mathworks.com/matlabcentral/fileexchange/27991-tight-subplot |tight_subplot|> was a previous Pick-of-the-Week.) 

%%
% 
% <<http://blogs.mathworks.com/pick/files/colorspaceList.png>>
% 

%%
% Now I have a lot more options at my disposal for segmenting images!

%% 
% P.S. I know you can't really see what's happening in those tiny thumbnails*,
% but then that's the beauty of
% <http://www.mathworks.com/matlabcentral/fileexchange/18291-expandaxes |expandAxes|>;
% if you were to run the code snippet above, you would be able to click on
% any of those tiny axes and expand them to full-frame. And you could
% right-click on any expanded axes to export the image to the Workspace!

%% 
% *P.P.S. If your image is large, doing what I just did could be a very bad
% idea. These aren't really "thumbnails"; even if the visualization is small, 
% each of those image objects has in its <http://www.mathworks.com/help/releases/R2013a/matlab/ref/image_props.html "cdata">
% container a full copy of the image it reflects.

%% 
% Thank you, Oliver, for the suggestion. And thank _you_, Pascal, for the
% very useful submission. Swag on the way to both of you!

%%
% As always, I welcome your
% <http://blogs.mathworks.com/pick/?p=4556#respond thoughts and comments>.
% Or leave feedback for Pascal <http://www.mathworks.com/matlabcentral/fileexchange/28790#comments here>.
##### SOURCE END ##### b7763c2fc1234b029827c0f68bbf81b4
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/05/10/colorspaces-out-the-wazoo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi DC Motor Driver</title>
		<link>http://blogs.mathworks.com/pick/2013/05/03/raspberry-pi-dc-motor-driver/</link>
		<comments>http://blogs.mathworks.com/pick/2013/05/03/raspberry-pi-dc-motor-driver/#comments</comments>
		<pubDate>Fri, 03 May 2013 13:00:27 +0000</pubDate>
		<dc:creator>Guest Picker</dc:creator>
				<category><![CDATA[Simulink]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4536</guid>
		<description><![CDATA[Doug's pick this week is Raspberry Pi DC Motor H-Bridge Driver Block by Joshua Hurst. As my previous posts may suggest, I've been a long-time fan of the Arduino platform. Among other things I use it as the basis of a demonstration to showcase a variety of MathWorks' tools that includes driving a motor to [...]]]></description>
				<content:encoded><![CDATA[<a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/62957">Doug</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/41528-raspberry-pi-dc-motor-h-bridge-driver-block-sfunction">Raspberry Pi DC Motor H-Bridge Driver Block</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/319689">Joshua Hurst</a>.
<br /><br />
As my previous posts may suggest, I've been a long-time fan of the Arduino platform. Among other things I use it as the basis of a demonstration to showcase a variety of MathWorks' tools that includes driving a motor to rotate a camera to track an object. The Arduino works great for doing closed-loop position control of the camera, but falls short when it comes to actually processing the camera video to detect the object. So currently the video processing is relegated to my laptop which prevents me from creating a completely embedded solution.
<br /><br />
Enter R2013a which introduced support for a number of new target platforms which <a href="http://blogs.mathworks.com/pick/2013/03/15/additional-hardware-support-in-r2013a/">Jiro pointed out</a> earlier this year. I was drawn to Raspberry Pi in particular because it is a similar price and form factor to the Arduino, but has built-in support for USB webcams:
<br /><br />
<img src="http://www.mathworks.com/images/nextgen/supporting/academia/hardware-resources/raspberry-pi-gallery-image-3.jpg" alt="Raspberry Pi Block Library" />
<br /><br />
Looking at the blocks that are included with the target, however, you'll notice that there is nothing included for sending voltages to a DC Motor like you can do with the Arduino PWM Output blocks. Because of that I had initially planned to use both the Raspberry Pi and Arduino for my demo until I ran across Joshua's submission the other day. His model uses S-Function Builder blocks to take advantage of the new <a href="https://projects.drogon.net/raspberry-pi/wiringpi/">WiringPi</a> support in the Raspberry Pi image that is used in the support package. Here's the top-level of Joshua's model:
<br /><br />
<img src="http://blogs.mathworks.com/pick/files/MotorDriverModel.png" alt="Motor Driver Model" />
<br /><br />
After some breadboard work, I built and downloaded the model and I was controlling my motor in minutes by simply changing the Input Volts value in External Mode. Now I just need to decide on the best way to read the motor's potentiometer then the whole system can run on the Pi. Or perhaps I should bite the bullet and switch to an encoder. If anyone has any suggestions, leave a comment! 
<br /><br />
I was happy to see that Joshua was inspired by Giampiero's <a href="http://www.mathworks.com/matlabcentral/fileexchange/39354-device-drivers">Device Driver guide</a> that explains how to create custom drivers for the hardware support packages. Joshua has also recently uploaded several other related submissions. I'm looking forward to seeing what Joshua and others come up with in the future to increase the I/O options for the different hardware platforms.
<br /><br />
One minor suggestion I would have for Joshua is to include the pin numbers that correspond to the PWM outputs for this model. I had to do a bit of hunting to track that down (it's 7 and 11 on the P1 header for those that are interested). But other than that, this submission has been a big help, thanks Joshua!
<br /><br />
<strong>Comments</strong><br />
Let us know what you think <a href="http://blogs.mathworks.com/pick/?p=4536#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/41528-raspberry-pi-dc-motor-h-bridge-driver-block-sfunction/#comments">comment</a> for Joshua.]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/05/03/raspberry-pi-dc-motor-driver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Toggle that Fig</title>
		<link>http://blogs.mathworks.com/pick/2013/04/26/toggle-that-fig/</link>
		<comments>http://blogs.mathworks.com/pick/2013/04/26/toggle-that-fig/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 13:00:21 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4528</guid>
		<description><![CDATA[Jiro's pick this week is togglefig by our own Brett Shoelson.Brett and I, along with Bob, started writing for this blog about 5 years ago, back when Doug was still the owner of the blog. Since the beginning, we typically highlighted submissions that were written by the general public and not by one of us. [...]]]></description>
				<content:encoded><![CDATA[
<div class="content"><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/18220"><tt>togglefig</tt></a> by our own <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett Shoelson</a>.</p><p>Brett and I, along with Bob, started writing for this blog about 5 years ago, back when <a href="http://blogs.mathworks.com/videos/">Doug</a> was still the owner of the blog. Since the beginning, we typically highlighted submissions that were written by the general public and not by one of us. But ultimately, we like to highlight files that can be of some value to our readers, and I must say that there's no shortage of such files in <a href="http://www.mathworks.com/matlabcentral/fileexchange/index?term=authorid%3A911">Brett's entries</a>.</p><p>So what does <tt>togglefig</tt> do? Have you ever wanted to better manage your figure windows? I've often had a need to reuse my figure windows. Once, I was developing some piece of code that created multiple figures, and as I was iterating on my code, I kept creating the same number of windows each time, and I would end up with tens of figure windows open after a while. Of course I could "close all" of them at the beginning of my script, but I had some windows I needed open for other reasons. As a solution, I would create/select figures using some numbers, e.g.</p><pre class="language-matlab">figure(123)
</pre><p>This would always use the same figure window, or create one if it doesn't exist. But I would want to give a meaningful name to it, so then I would need to set the name property after getting the handle to the figure.</p><pre class="codeinput">h = figure(123);
set(h, <span class="string">'Name'</span>, <span class="string">'Important Window'</span>);
</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_togglefig/potw_togglefig_01.png" alt=""> <p>It works, but it's just some extra lines of code that are not adding any value to the real purpose of my program.</p><p>Brett's <tt>togglefig</tt> addresses this in a very elegant manner. It would raise the figure with the specified name, or create one if it doesn't exist.</p><pre class="codeinput">togglefig(<span class="string">'More Important Window'</span>)
</pre><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_togglefig/potw_togglefig_02.png" alt=""> <p>You can also pass in an optional argument to clear the figure window when it's given focus.</p><p>Thanks, Brett, for this extremely useful function that makes me more efficient in using MATLAB!</p><p><b>Comments</b></p><p>Let us know what you think <a href="http://blogs.mathworks.com/pick/?p=4528#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/18220#comments">comment</a> for Brett.</p><script language="JavaScript"> <!-- 
    function grabCode_f934efc8e76540b9b28977f011da5aba() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='f934efc8e76540b9b28977f011da5aba ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' f934efc8e76540b9b28977f011da5aba';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_f934efc8e76540b9b28977f011da5aba()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
f934efc8e76540b9b28977f011da5aba ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/18220 |togglefig|>
% by our own
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett
% Shoelson>.
%
% Brett and I, along with Bob, started writing for this blog about 5 years
% ago, back when <http://blogs.mathworks.com/videos/ Doug> was still the
% owner of the blog. Since the beginning, we typically highlighted
% submissions that were written by the general public and not by one of us.
% But ultimately, we like to highlight files that can be of some value to
% our readers, and I must say that there's no shortage of such files in
% <http://www.mathworks.com/matlabcentral/fileexchange/index?term=authorid%3A911
% Brett's entries>.
%
% So what does |togglefig| do? Have you ever wanted to better manage your
% figure windows? I've often had a need to reuse my figure windows. Once, I
% was developing some piece of code that created multiple figures, and as I
% was iterating on my code, I kept creating the same number of windows each
% time, and I would end up with tens of figure windows open after a while.
% Of course I could "close all" of them at the beginning of my script, but
% I had some windows I needed open for other reasons. As a solution, I
% would create/select figures using some numbers, e.g.
%
%   figure(123)
%
% This would always use the same figure window, or create one if it doesn't
% exist. But I would want to give a meaningful name to it, so then I would
% need to set the name property after getting the handle to the figure.

h = figure(123);
set(h, 'Name', 'Important Window');

%%
% It works, but it's just some extra lines of code that are not adding any
% value to the real purpose of my program.
%
% Brett's |togglefig| addresses this in a very elegant manner. It would raise
% the figure with the specified name, or create one if it doesn't exist.

togglefig('More Important Window')

%%
% You can also pass in an optional argument to clear the figure window when
% it's given focus.
% 
% Thanks, Brett, for this extremely useful function that makes me more
% efficient in using MATLAB!
% 
% *Comments*
%
% Let us know what you think
% <http://blogs.mathworks.com/pick/?p=4528#respond here> or leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/18220#comments
% comment> for Brett.

##### SOURCE END ##### f934efc8e76540b9b28977f011da5aba
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/04/26/toggle-that-fig/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Manage the (Automatic) Naming of Your Figure Windows</title>
		<link>http://blogs.mathworks.com/pick/2013/04/19/manage-the-automatic-naming-of-your-figure-windows/</link>
		<comments>http://blogs.mathworks.com/pick/2013/04/19/manage-the-automatic-naming-of-your-figure-windows/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 13:00:48 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4507</guid>
		<description><![CDATA[Brett's Pick this week is "setname", by Andrew Bliss.Some of you may be familiar with my own togglefig function; it allows one to recall and reuse a figure by specifying its name. I find it extremely practical, and I use it almost on a daily basis. (It's particularly useful when you're iterating on a block [...]]]></description>
				<content:encoded><![CDATA[
<div class="content"><!--introduction--><!--/introduction--><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/33076">"setname"</a>, by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/20418">Andrew Bliss</a>.</p><p>Some of you may be familiar with my own <a href="http://www.mathworks.com/matlabcentral/fileexchange/18220"><tt>togglefig</tt></a> function; it allows one to recall and reuse a figure by specifying its name. I find it extremely practical, and I use it almost on a daily basis. (It's particularly useful when you're iterating on a block of code separated into <a href="http://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html#brqxeeu-271">"sections."</a> Andrew's <tt>setname</tt> makes a very nice companion to <tt>togglefig</tt>.)</p><p>As of this writing, Andrew has 10 files on the Exchange, which have collectively been downloaded more than 500 times in the past 30 days. (Not too shabby!) Nonetheless, I don't believe any of his submissions have previously been recognized as a Pick of the Week. Until now.</p><p>Ironically, the file of Andrew's that I am most enamored of is his least-downloaded.</p><p>So what does Andrew's function do? If you've previously indicated a title for the axes in your figure, <tt>setname</tt> automatically renames the figure to match axes name. If you haven't titled your graphic, the function extracts a string from the x- and y- labels of the axes to construct a figure name.</p><p>Consider, for example, this snippet of code:</p><pre class="language-matlab">t = 0:pi/64:8*pi;
plot(t,sin(t)+rand(size(t)))
xlabel(<span class="string">'Time'</span>)
ylabel(<span class="string">'Noisy Sine'</span>)
title(<span class="string">'Noisy Sinusoid'</span>)
</pre><p>This creates a figure not-so-usefully named "Untitled" (with a number appended to differentiate it from the other <i>n</i> "Untitled" figures you've previously created.)</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/setname1.png" alt=""> </p><p>Now issue the <tt>setname</tt> command (no arguments needed--it works by default on the current axes, though you may specify a non-default axes.) Now the figure is renamed to "Noisy Sinusoid," and you can readily pick it out from all the other open figures.</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/setname2.png" alt=""> </p><p>Alternatively, if you didn't explicitly provide a title, <tt>setname</tt> would automatically name the figure "Time vs Noisy Sine." Now not only can I find the figure, I can easily reuse it:</p><pre class="language-matlab"><span class="comment">% Recall the previous figure...</span>
togglefig(<span class="string">'Noisy Sinusoid'</span>)
plot(t,cos(t)+rand(size(t)))
title(<span class="string">'Noisy Cosine'</span>)
<span class="comment">% ...and then rename the figure!</span>
setname
</pre><p>This is brilliant, Andrew...thanks! One suggestion: it would be really nice if I could pass to <tt>setname</tt> an argument ('all'?) that tells the function to rename all open figures. (For those times when I've lazily created 20 different 'Untitled' figures.)</p><p>As always, I welcome your <a href="http://blogs.mathworks.com/pick/?p=4507#respond">thoughts and comments</a>. Or leave feedback for Andrew <a href="http://www.mathworks.com/matlabcentral/fileexchange/33076#comments">here</a>.</p><script language="JavaScript"> <!-- 
    function grabCode_be14492a2d024f0388667063ce7da3f5() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='be14492a2d024f0388667063ce7da3f5 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' be14492a2d024f0388667063ce7da3f5';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_be14492a2d024f0388667063ce7da3f5()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
be14492a2d024f0388667063ce7da3f5 ##### SOURCE BEGIN #####
%% Manage the (Automatic) Naming of Your Figure Windows
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/33076 "setname">, by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/20418 Andrew Bliss>.

%%
% Some of you may be familiar with my own 
% <http://www.mathworks.com/matlabcentral/fileexchange/18220 |togglefig|> function; it allows
% one to recall and reuse a figure by specifying its name. I find it
% extremely practical, and I use it almost on a daily basis. (It's particularly useful 
% when you're iterating on a block of code separated into 
% <http://www.mathworks.com/help/matlab/matlab_prog/run-sections-of-programs.html#brqxeeu-271 "sections."> 
% Andrew's |setname| makes a very nice companion to |togglefig|.)

%%
% As of this writing, Andrew has 10 files on the Exchange, which have
% collectively been downloaded more than 500 times in the past 30 days.
% (Not too shabby!) Nonetheless, I don't believe any of his submissions
% have previously been recognized as a Pick of the Week. Until now. 

%%
% Ironically, the file of Andrew's that I am most enamored of is his
% least-downloaded.

%%
% So what does Andrew's function do? If you've previously indicated a title for the axes in your 
% figure, |setname| automatically renames the figure to match axes name. If you haven't 
% titled your graphic, the function extracts a string from the x- and y-
% labels of the axes to construct a figure name.

%%
% Consider, for example, this snippet of code:
%
%   t = 0:pi/64:8*pi;
%   plot(t,sin(t)+rand(size(t)))
%   xlabel('Time')
%   ylabel('Noisy Sine')
%   title('Noisy Sinusoid')

%%
% This creates a figure not-so-usefully named "Untitled" (with a number
% appended to differentiate it from the other _n_ "Untitled" figures you've
% previously created.)

%%
% 
% <<http://blogs.mathworks.com/pick/files/setname1.png>>
% 

%% 
% Now issue the |setname| command (no arguments neededREPLACE_WITH_DASH_DASHit works by default
% on the current axes, though you may specify a non-default axes.) Now the
% figure is renamed to "Noisy Sinusoid," and you can readily pick it out
% from all the other open figures.

%%
% 
% <<http://blogs.mathworks.com/pick/files/setname2.png>>
% 

%%
% Alternatively, if you didn't explicitly provide a title, |setname| would
% automatically name the figure "Time vs Noisy Sine." Now not
% only can I find the figure, I can easily reuse it:

%%
%   % Recall the previous figure...
%   togglefig('Noisy Sinusoid')
%   plot(t,cos(t)+rand(size(t)))
%   title('Noisy Cosine')
%   % ...and then rename the figure!
%   setname

%%
% This is brilliant, Andrew...thanks! One suggestion: it would be really
% nice if I could pass to |setname| an argument ('all'?) that tells the
% function to rename all open figures. (For those times when I've lazily created 20
% different 'Untitled' figures.)

%% 
% As always, I welcome your
% <http://blogs.mathworks.com/pick/?p=4507#respond thoughts and comments>.
% Or leave feedback for Andrew <http://www.mathworks.com/matlabcentral/fileexchange/33076#comments here>.
##### SOURCE END ##### be14492a2d024f0388667063ce7da3f5
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/04/19/manage-the-automatic-naming-of-your-figure-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simulate Robots with Sim.I.am</title>
		<link>http://blogs.mathworks.com/pick/2013/04/12/simulate-robots-with-sim-i-am/</link>
		<comments>http://blogs.mathworks.com/pick/2013/04/12/simulate-robots-with-sim-i-am/#comments</comments>
		<pubDate>Fri, 12 Apr 2013 13:00:41 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4498</guid>
		<description><![CDATA[Jiro's pick this week is Sim.I.am by Jean-Pierre de la Croix.This week, I had a trip to University of Cincinnati with my colleague (and fellow blogger) Sean de Wolski. There, I did a session titled "Enabling Project-Based Learning with MATLAB, Simulink, and Hardware". Project-based learning is a "collaborative education style facilitated by teachers, aimed at [...]]]></description>
				<content:encoded><![CDATA[

<div class="content"><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/40860">Sim.I.am</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/331930">Jean-Pierre de la Croix</a>.</p><p>This week, I had a trip to University of Cincinnati with my colleague (and fellow blogger) Sean de Wolski. There, I did a session titled "Enabling Project-Based Learning with MATLAB, Simulink, and Hardware". <a href="http://en.wikipedia.org/wiki/Project-based_learning">Project-based learning</a> is a "collaborative education style facilitated by teachers, aimed at increasing students' retention of content in a way that is directly engaging, through projects applicable to life outside of the classroom." There are various tools that would serve the purpose of engaging students, and MATLAB and Simulink are certainly among them.</p><p>With MATLAB and Simulink, you can have software-based projects (simulations) and hardware-based projects. I wrote about some of the <a href="http://blogs.mathworks.com/pick/2013/03/15/additional-hardware-support-in-r2013a/">hardware support</a> that is included with Simulink, and this allows you to easily take what you have in simulation onto low cost hardware. However, when you are trying to implement a project-based learning approach for a class of hundreds of students, purchasing hardware devices for every student becomes impractical. In that case, simulation becomes even more important.</p><p>Jean-Pierre is a Ph.D. student in <a href="http://gritslab.gatech.edu/home/">GRITSLab</a> at <a href="http://www.gatech.edu/">Georgia Tech</a> (my alma mater!). Sim.I.am is a simulator that can be used to learn and apply control theory for mobile robots. The robot used in the simulator is based on the <a href="http://www.k-team.com/mobile-robotics-products/khepera-iii">Khepera III (K3)</a> mobile robot. This File Exchange submission comes with a detailed manual for the simulator, although the App is user-friendly and self-explanatory. What I like even more is the collection of programming exercises included with the package. It's ready to be used in a robotics course right away!</p><p>In this animation, you can see a target-seeking algorithm in action. The green dot indicates the target that the robot seeks.</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_simiam/simiam_simulator_animation.gif" alt=""> </p><p>At my session at University of Cincinnati, I also talked about a similar <a href="http://verifiablerobotics.com/CreateMATLABsimulator/createsimulator.html">MATLAB-based Simulator</a> for the <a href="http://store.irobot.com/shop/index.jsp?categoryId=3311368">iRobot&reg; Create&reg;</a>. This simulator works alongside the <a href="http://www.mathworks.com/matlabcentral/fileexchange/32698">MATLAB-iRobot Create interface</a>, and this allows students to test their control algorithms they developed in simulation on the actual robot.</p><p>You can find other project-based learning materials created by people from around the world in the <a href="http://www.mathworks.com/academia/classroom-resources/">Classroom Resources</a> page. Check out the <a href="http://www.mathworks.com/academia/hardware-resources/">Hardware for Project-Based Learning</a> page to see what kind of hardware platforms interface with MATLAB and Simulink.</p><p><b>Comments</b></p><p>Are you involved with project-based learning? Let us know about it <a href="http://blogs.mathworks.com/pick/?p=4498#respond">here</a> and leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/40860#comments">comment</a> for Jean-Pierre.</p><script language="JavaScript"> <!-- 
    function grabCode_b14eeac56d6144d1a4015d90465cd909() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='b14eeac56d6144d1a4015d90465cd909 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' b14eeac56d6144d1a4015d90465cd909';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_b14eeac56d6144d1a4015d90465cd909()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
b14eeac56d6144d1a4015d90465cd909 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/40860 Sim.I.am> by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/331930
% Jean-Pierre de la Croix>.
%
% This week, I had a trip to University of Cincinnati with my colleague
% (and fellow blogger) Sean de Wolski. There, I did a session titled
% "Enabling Project-Based Learning with MATLAB, Simulink, and Hardware".
% <http://en.wikipedia.org/wiki/Project-based_learning Project-based
% learning> is a "collaborative education style facilitated by teachers,
% aimed at increasing students' retention of content in a way that is
% directly engaging, through projects applicable to life outside of the
% classroom." There are various tools that would serve the purpose of
% engaging students, and MATLAB and Simulink are certainly among them.
%
% With MATLAB and Simulink, you can have software-based projects
% (simulations) and hardware-based projects. I wrote about some of the
% <http://blogs.mathworks.com/pick/2013/03/15/additional-hardware-support-in-r2013a/
% hardware support> that is included with Simulink, and this allows you to
% easily take what you have in simulation onto low cost hardware. However,
% when you are trying to implement a project-based learning approach for a
% class of hundreds of students, purchasing hardware devices for every
% student becomes impractical. In that case, simulation becomes even more
% important.
%
% Jean-Pierre is a Ph.D. student in <http://gritslab.gatech.edu/home/
% GRITSLab> at <http://www.gatech.edu/ Georgia Tech> (my alma mater!).
% Sim.I.am is a simulator that can be used to learn and apply control
% theory for mobile robots. The robot used in the simulator is based on the
% <http://www.k-team.com/mobile-robotics-products/khepera-iii Khepera III
% (K3)> mobile robot. This File Exchange submission comes with a detailed
% manual for the simulator, although the App is user-friendly and
% self-explanatory. What I like even more is the collection of programming
% exercises included with the package. It's ready to be used in a robotics
% course right away!
%
% In this animation, you can see a target-seeking algorithm in action. The
% green dot indicates the target that the robot seeks.
%
% <<simiam_simulator_animation.gif>>
%
% At my session at University of Cincinnati, I also talked about a similar
% <http://verifiablerobotics.com/CreateMATLABsimulator/createsimulator.html
% MATLAB-based Simulator> for the
% <http://store.irobot.com/shop/index.jsp?categoryId=3311368 iRobotÂ®
% CreateÂ®>. This simulator works alongside the
% <http://www.mathworks.com/matlabcentral/fileexchange/32698 MATLAB-iRobot
% Create interface>, and this allows students to test their control
% algorithms they developed in simulation on the actual robot.
%
% You can find other project-based learning materials created by people
% from around the world in the
% <http://www.mathworks.com/academia/classroom-resources/ Classroom
% Resources> page. Check out the
% <http://www.mathworks.com/academia/hardware-resources/ Hardware for
% Project-Based Learning> page to see what kind of hardware platforms
% interface with MATLAB and Simulink.
% 
% *Comments*
%
% Are you involved with project-based learning? Let us know about it
% <http://blogs.mathworks.com/pick/?p=4498#respond here> and leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/40860#comments
% comment> for Jean-Pierre.

##### SOURCE END ##### b14eeac56d6144d1a4015d90465cd909
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/04/12/simulate-robots-with-sim-i-am/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>3D Image Viewer</title>
		<link>http://blogs.mathworks.com/pick/2013/04/05/3d-image-viewer/</link>
		<comments>http://blogs.mathworks.com/pick/2013/04/05/3d-image-viewer/#comments</comments>
		<pubDate>Fri, 05 Apr 2013 13:00:24 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4484</guid>
		<description><![CDATA[Jiro's pick this week is Imagine by Christian Wuerslin.This is just a cool app. It's a 3D image viewer with a well-designed user interface. I'm sure this will be useful to anyone working with slices of 3D images.clear load data whos Name Size Bytes Class Attributes D 4-D 442368 uint8 S 4-D 21327411 uint8 Both [...]]]></description>
				<content:encoded><![CDATA[<div class="content"><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/40440">Imagine</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/323331">Christian Wuerslin</a>.</p><p>This is just a cool app. It's a 3D image viewer with a well-designed user interface. I'm sure this will be useful to anyone working with slices of 3D images.</p><pre class="codeinput">clear
load <span class="string">data</span>
whos
</pre><pre class="codeoutput">  Name      Size               Bytes  Class    Attributes

  D         4-D               442368  uint8              
  S         4-D             21327411  uint8              

</pre><p>Both "D" and "S" (pardon the nondescript names) are volumes of MRI data. "D" is from a data set that ships with MATLAB (<tt>load mri</tt>).</p><pre class="codeinput">fprintf(<span class="string">'Size of D:   %d x %d x %d x %d\n'</span>, size(D));
</pre><pre class="codeoutput">Size of D:   128 x 128 x 1 x 27
</pre><p>I created "S" from <a href="http://brainweb.bic.mni.mcgill.ca/brainweb/">BrainWeb: Simulated Brain Database</a>. They have simulated MRI data that people can use to test imaging techniques. I downloaded the "normal brain" data and the "MS lesion brain" data. I combined the two 3D MRI data, along with the difference between the two data sets, into a single variable "S".</p><pre class="codeinput">fprintf(<span class="string">'Size of S:   %d x %d x %d x %d\n'</span>, size(S));
</pre><pre class="codeoutput">Size of S:   181 x 217 x 181 x 3
</pre><p>Here's a peek at what this app can do. A few points to note:</p><div><ul><li>If you load in a 3D data set, you can scroll through the different slices using the scroll wheel on your mouse. You can also rotate to a different angle.</li><li>The 4th dimension is displayed in different panels, and the data sets can be explored in sync.</li><li>You can create custom analyses for a line profile or a polygon ROI. The tool comes with a default analysis routine, which you can see in the animation below.</li></ul></div><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_imagine/imagine_animation.gif" alt=""> </p><p>He also includes a Users Manual that will get you up and running right away. Thanks for making an already easy-to-use tool even easier, Christian!</p><p><b>Comments</b></p><p>Let us know what you think <a href="http://blogs.mathworks.com/pick/?p=4484#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/40440#comments">comment</a> for Christian.</p><script language="JavaScript"> <!-- 
    function grabCode_12f044f77099481fbd1326bb6458d2b7() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='12f044f77099481fbd1326bb6458d2b7 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 12f044f77099481fbd1326bb6458d2b7';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_12f044f77099481fbd1326bb6458d2b7()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
12f044f77099481fbd1326bb6458d2b7 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/40440 Imagine> by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/323331
% Christian Wuerslin>.
%
% This is just a cool app. It's a 3D image viewer with a
% well-designed user interface. I'm sure this will be useful to anyone
% working with slices of 3D images.

clear
load data
whos

%%
% Both "D" and "S" (pardon the nondescript names) are volumes of MRI data.
% "D" is from a data set that ships with MATLAB (|load mri|).

fprintf('Size of D:   %d x %d x %d x %d\n', size(D));

%%
% I created "S" from <http://brainweb.bic.mni.mcgill.ca/brainweb/ BrainWeb:
% Simulated Brain Database>. They have simulated MRI data that people can
% use to test imaging techniques. I downloaded the "normal brain" data and
% the "MS lesion brain" data. I combined the two 3D MRI data, along with
% the difference between the two data sets, into a single variable "S".

fprintf('Size of S:   %d x %d x %d x %d\n', size(S));

%%
% Here's a peek at what this app can do. A few points to note:
%
% * If you load in a 3D data set, you can scroll through the different
% slices using the scroll wheel on your mouse. You can also rotate to a
% different angle.
% * The 4th dimension is displayed in different panels, and the data sets
% can be explored in sync.
% * You can create custom analyses for a line profile or a polygon ROI. The
% tool comes with a default analysis routine, which you can see in the
% animation below.
%
% <<imagine_animation.gif>>
%
% He also includes a Users Manual that will get you up and running right
% away. Thanks for making an already easy-to-use tool even easier,
% Christian!
%
% *Comments*
%
% Let us know what you think
% <http://blogs.mathworks.com/pick/?p=4484#respond here> or leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/40440#comments
% comment> for Christian.

##### SOURCE END ##### 12f044f77099481fbd1326bb6458d2b7
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/04/05/3d-image-viewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate a Smile&#8230;Maybe</title>
		<link>http://blogs.mathworks.com/pick/2013/03/29/generate-a-smile-maybe/</link>
		<comments>http://blogs.mathworks.com/pick/2013/03/29/generate-a-smile-maybe/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 13:00:56 +0000</pubDate>
		<dc:creator>bshoelso</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4460</guid>
		<description><![CDATA[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 [...]]]></description>
				<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction></introduction>
   <p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/911">Brett</a>'s Pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/40371">"Random Face Generator"</a>, by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/269973">Joseph Hollmann</a>.
   </p>
   <p>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.
   </p>
   <p>So, in the spirit of Spring Break and focusing on family fun, a bit of frivolity for today's Pick.</p>
   <p>Joseph's submission doesn't really do anything of a practical nature, but it <i>does</i> make you smile. As he says in the preamble to his code, <tt>randomfacegenerator</tt> "generates a randomly created face and plots it....nothing else."
   </p>
   <p>I have one suggestion for improvement. Calling the <tt>figure</tt> 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:
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">figure;
set(gcf,<span style="color: #A020F0">'name'</span>,<span style="color: #A020F0">'Your New Face'</span>);</pre><p>with a call to <a href="http://www.mathworks.com/matlabcentral/fileexchange/18220"><tt>togglefig</tt></a>:
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">togglefig(<span style="color: #A020F0">'Your New Face'</span>)</pre><p>(That is, if a figure named "Your New Face" exists, activate and reuse it. Otherwise, create it.) No inputs required:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)"><span style="color: #0000FF">while</span> ~strcmp(get(gcf,<span style="color: #A020F0">'currentcharacter'</span>),<span style="color: #A020F0">'s'</span>)
randomfacegenerator
pause(0.5);
<span style="color: #0000FF">end</span></pre><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/RandomFaces.gif"> </p>
   <p>Thanks for putting me in vacation mode a day early, Joseph!</p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/pick/files/smile.png"> </p>
   <p>As always, I welcome your <a href="http://blogs.mathworks.com/pick/?p=4460#respond">thoughts and comments</a>. Or leave feedback for Joseph <a href="http://www.mathworks.com/matlabcentral/fileexchange/40371#comments">here</a>.
   </p><script language="JavaScript">
<!--

    function grabCode_f1a450ebddb1442dbafa70f139c72019() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='f1a450ebddb1442dbafa70f139c72019 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' f1a450ebddb1442dbafa70f139c72019';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'Brett Shoelson';
        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_f1a450ebddb1442dbafa70f139c72019()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p>
</div>
<!--
f1a450ebddb1442dbafa70f139c72019 ##### SOURCE BEGIN #####
%% Generate a Smile...Maybe
%% 
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/911 Brett>'s Pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/40371 "Random Face Generator">, by
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/269973 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 <http://www.mathworks.com/matlabcentral/fileexchange/18220 |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

%%
% 
% <<http://blogs.mathworks.com/pick/files/RandomFaces.gif>>
% 

%%
% Thanks for putting me in vacation mode a day early, Joseph!

%%
% 
% <<http://blogs.mathworks.com/pick/files/smile.png>>
% 


%% 
% As always, I welcome your
% <http://blogs.mathworks.com/pick/?p=4460#respond thoughts and comments>.
% Or leave feedback for Joseph <http://www.mathworks.com/matlabcentral/fileexchange/40371#comments here>.
##### SOURCE END ##### f1a450ebddb1442dbafa70f139c72019
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/03/29/generate-a-smile-maybe/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>All Purpose Mortgage Calculator including mortgage schedule</title>
		<link>http://blogs.mathworks.com/pick/2013/03/22/all-purpose-mortgage-calculator-including-mortgage-schedule/</link>
		<comments>http://blogs.mathworks.com/pick/2013/03/22/all-purpose-mortgage-calculator-including-mortgage-schedule/#comments</comments>
		<pubDate>Fri, 22 Mar 2013 13:01:00 +0000</pubDate>
		<dc:creator>Guest Picker</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4438</guid>
		<description><![CDATA[Sean's pick this week is All Purpose Mortgage Calculator including mortgage schedule by S B. I am currently in the fun process of buying a house. My wife and I were going over the mortgage calculations the other day and figuring out our approximate monthly payments and the amount of money we want to put [...]]]></description>
				<content:encoded><![CDATA[<div xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" class="content">
   <introduction>
      <p><a href="http://www.mathworks.com/matlabcentral/answers/contributors/3208495-sean-de-wolski">Sean's</a> pick this week is <a href="http://www.mathworks.com/matlabcentral/fileexchange/8009-all-purpose-mortgage-calculator-including-mortgage-schedule">All Purpose Mortgage Calculator including mortgage schedule</a> by <a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/17355">S B</a>.
      </p>
      <p>I am currently in the <i>fun</i> process of buying a house.  My wife and I were going over the mortgage calculations the other day and figuring out our approximate
         monthly payments and the amount of money we want to put down.  We know that the financial company we are using probably knows
         how to do these calculations.  But we wanted to check them!  I also noticed that they were using Excel so that made me curious
         to see how easy this would be in my choice software for <b>everything</b>, MATLAB.
      </p>
      <p>It's generally the case that if functionality for MATLAB seems obvious, it's probably built in to the product or one of the
         toolboxes.  If this is not the case, then someone else has likely already written it and deposited it on the File Exchange.
          I vaguely remembered this App from a few months ago when my friend <a href="http://blogs.mathworks.com/videos/">Doug</a> and I were talking about the great low interests rates available right now.
      </p>
      <p><b>NOTE</b> <i>All numbers below have been obfuscated to hide the actual financial details.</i></p>
   </introduction>
   <h3>Contents</h3>
   <div>
      <ul>
         <li><a href="#1">Apps</a></li>
         <li><a href="#2">This App</a></li>
         <li><a href="#3">The Code</a></li>
         <li><a href="#5">Some Suggested Future Enhancements</a></li>
         <li><a href="#6">Comments</a></li>
      </ul>
   </div>
   <h3>Apps<a name="1"></a></h3>
   <p>In MATLAB R2012b, we introduced <a href="http://www.mathworks.com/help/releases/R2013a/matlab/creating_guis/apps-overview.html">MATLAB Apps</a> and the Apps Toolbar:
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/guest/main/appsTab.PNG"> </p>
   <p>Using MATLAB Apps you can package your GUIs and their dependencies into single files that can be distributed and installed
      easily.  This will help your users avoid the standard path issues.  Apps also enable you to have easy version control and
      descriptions for your GUIs.
   </p>
   <p><b>Side Note:</b>  I know that during the R2012b release many of you wanted to be able to change the App icon.  In R2013a, the ability to select
      an icon from one of a dozen is available.
   </p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/guest/main/appsicons.PNG"> </p>
   <h3>This App<a name="2"></a></h3>
   <p>So let's take a look at this App:</p>
   <p>We'll first try 20% down:</p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/guest/main/app1.PNG"> </p>
   <p>How does that compare to 5% down (not including Private Mortgage Insurance (PMI)):</p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/guest/main/app2.PNG"> </p>
   <p>So the total interest saved by putting down 20% instead of 5% is about $28K, not including PMI.</p>
   <p>What if we could shorten it to 15 years?</p>
   <p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/guest/main/app3.PNG"> </p>
   <p>This just about halves the amount of interest!</p>
   <p>Unfortunately, the plot does not work for any number of years less than 30 (enhancement!)</p>
   <p>For every scenario, the numbers lined up with those that the financial firm gave us verifying both their calculations and
      this App.
   </p>
   <h3>The Code<a name="3"></a></h3>
   <p>Though we have a big suite of Financial Products, none of them were used here.  The engine behind this appears to be about
      20 lines of MATLAB code and everything else is just for the GUI.
   </p>
   <p>One thing I noticed is that S B did a lot of work for selecting the colors for the plot lines. Here's what he did:</p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">color_map = [<span style="color: #A020F0">'rbgrbmbrgr'</span>];
z1 = 0;
z2 = 0;

<span style="color: #0000FF">while</span> (z1 == 0) | (z1 &gt; 9) | (z2 == 0) | (z2 &gt; 9)

    z1 = fix(rand(1)*10);
    z2 = fix(rand(1)*10);

    <span style="color: #228B22">% What are the chances of get the same random number twice!?</span>
    <span style="color: #0000FF">if</span> (z1 == z2)
        z1 = fix(rand(1)*10);
        z2 = fix(rand(1)*10);
    <span style="color: #0000FF">end</span>
<span style="color: #0000FF">end</span>
z1 = color_map(z1);
z2 = color_map(z2);</pre><p>I would recommend just using <a href="http://www.mathworks.com/help/releases/R2013a/matlab/ref/randperm.html"><tt>randperm()</tt></a> to guarantee two unique integers between one and nine.
   </p><pre style="background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)">color_map = <span style="color: #A020F0">'rgbcmyk'</span>;
idx       = randperm(numel(color_map),2);
color1    = color_map(idx(1))
color2    = color_map(idx(2))</pre><pre style="font-style:oblique">
color1 =

k


color2 =

b

</pre><h3>Some Suggested Future Enhancements<a name="5"></a></h3>
   <p>There are a few enhancements that would make this App even better!</p>
   <div>
      <ol>
         <li>The ability for it to plot for a term different than 30 years.</li>
         <li>The ability to account for overpayments (e.g. by just changing the   monthly amount).</li>
         <li>The ability to account for PMI.</li>
      </ol>
   </div>
   <h3>Comments<a name="6"></a></h3>
   <p>So the answer to my original question: <b>How easy would it be to do this in MATLAB?</b> <i>Really easy!</i></p>
   <p>Let us know what you think <a href="http://blogs.mathworks.com/pick/?p=4438#respond">here</a> or leave a <a href="http://www.mathworks.com/matlabcentral/fileexchange/8009#comments">comment</a> for S B.
   </p><script language="JavaScript">
<!--

    function grabCode_5df4065f140f4e1eb657f0e9a78a8b56() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='5df4065f140f4e1eb657f0e9a78a8b56 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' 5df4065f140f4e1eb657f0e9a78a8b56';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        author = 'guest';
        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add author and copyright lines at the bottom if specified.
        if ((author.length > 0) || (copyright.length > 0)) {
            d.writeln('');
            d.writeln('%%');
            if (author.length > 0) {
                d.writeln('% _' + author + '_');
            }
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');
      
      d.title = title + ' (MATLAB code)';
      d.close();
      }   
      
-->
</script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_5df4065f140f4e1eb657f0e9a78a8b56()"><span style="font-size: x-small;        font-style: italic;">Get 
            the MATLAB code 
            <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p>
</div>
<!--
5df4065f140f4e1eb657f0e9a78a8b56 ##### SOURCE BEGIN #####
%% All Purpose Mortgage Calculator including mortgage schedule
% Sean's pick this week is
% <http://www.mathworks.com/matlabcentral/fileexchange/8009-all-purpose-mortgage-calculator-including-mortgage-schedule
% All Purpose Mortgage Calculator including mortgage schedule> by <http://www.mathworks.com/matlabcentral/fileexchange/authors/17355 S B>.
%
% I am currently in the _fun_ process of buying a house.  My wife and I
% were going over the mortgage calculations the other day and figuring out
% our approximate monthly payments and the amount of money we want to put
% down.  We know that the financial company we are using probably knows how
% to do these calculations.  But we wanted to check them!  I also noticed
% that they were using Excel so that made me curious to see how easy this
% would be in my choice software for *everything*, MATLAB.
% 
% It's generally the case that if functionality for MATLAB seems obvious,
% it's probably built in to the product or one of the toolboxes.  If this
% is not the case, then someone else has likely already written it and
% deposited it on the File Exchange.  I vaguely remembered this App from a
% few months ago when my friend <http://blogs.mathworks.com/videos/ Doug>
% and I were talking about the great low interests rates available right
% now.
%
% *NOTE* _All numbers below have been obfuscated to hide the actual financial
% details._
%


%% Apps
% In MATLAB R2012b, we introduced
% <http://www.mathworks.com/help/releases/R2013a/matlab/creating_guis/apps-overview.html
% MATLAB Apps> and the Apps Toolbar:
%
% <<./guest/main/APPSTAB.PNG>>
%
% Using MATLAB Apps you can package your GUIs and their dependencies into
% single files that can be distributed and installed easily.  This will
% help your users avoid the standard path issues.  Apps also enable you to
% have easy version control and descriptions for your GUIs.
%
% *Side Note:*  I know that during the R2012b release many of you wanted to
% be able to change the App icon.  In R2013a, the ability to select an icon
% from one of a dozen is available. 
%
% <<APPSICONS.PNG>>
%

%% This.App
% So let's take a look at this App:
%
% We'll first try 20% down:
%
% <<./guest/main/APP1.PNG>>
%
% How does that compare to 5% down (not including Private Mortgage Insurance (PMI)):
% 
% <<APP2.PNG>>
%
% So the total interest saved by putting down 20% instead of 5% is about
% $28K, not including PMI.
%
% What if we could shorten it to 15 years?
%
% <<APP3.PNG>>
%
% This just about halves the amount of interest!
%
% Unfortunately, the plot does not work for any number of years less than
% 30 (enhancement!)
%
% For every scenario, the numbers lined up with those that the financial
% firm gave us verifying both their calculations and this App.
%


%% The Code
%
% Though we have a big suite of Financial Products, none of them were used
% here.  The engine behind this appears to be about 20 lines of MATLAB code
% and everything else is just for the GUI.  
%
% One thing I noticed is that S B did a lot of work for selecting the
% colors for the plot lines. Here's what he did:
% 

color_map = ['rbgrbmbrgr'];
z1 = 0;
z2 = 0;

while (z1 == 0) | (z1 > 9) | (z2 == 0) | (z2 > 9)
    
    z1 = fix(rand(1)*10);
    z2 = fix(rand(1)*10);
    
    % What are the chances of get the same random number twice!?
    if (z1 == z2)
        z1 = fix(rand(1)*10);
        z2 = fix(rand(1)*10);
    end
end
z1 = color_map(z1);
z2 = color_map(z2);

%%
%
% I would recommend just using
% <http://www.mathworks.com/help/releases/R2013a/matlab/ref/randperm.html
% |randperm()|> to guarantee two unique integers between one and nine.
%

color_map = 'rgbcmyk';
idx       = randperm(numel(color_map),2);
color1    = color_map(idx(1))
color2    = color_map(idx(2))



%% Some Suggested Future Enhancements
% There are a few enhancements that would make this App even better!
%
% # The ability for it to plot for a term different than 30 years.
% # The ability to account for overpayments (e.g. by just changing the
%   monthly amount).
% # The ability to account for PMI.
%

%% Comments
%
% So the answer to my original question: *How easy would it be to do this
% in MATLAB?* _Really easy_
% 
% Let us know what you think
% <http://blogs.mathworks.com/pick/?p=4438#respond here> or leave a
% <http://www.mathworks.com/matlabcentral/fileexchange/8009#comments
% comment> for S B.



##### SOURCE END ##### 5df4065f140f4e1eb657f0e9a78a8b56
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/03/22/all-purpose-mortgage-calculator-including-mortgage-schedule/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Additional Hardware Support in R2013a</title>
		<link>http://blogs.mathworks.com/pick/2013/03/15/additional-hardware-support-in-r2013a/</link>
		<comments>http://blogs.mathworks.com/pick/2013/03/15/additional-hardware-support-in-r2013a/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 13:00:19 +0000</pubDate>
		<dc:creator>Jiro Doke</dc:creator>
				<category><![CDATA[Picks]]></category>

		<guid isPermaLink="false">http://blogs.mathworks.com/pick/?p=4430</guid>
		<description><![CDATA[Jiro's pick this week is a collection of new hardware support packages introduced in R2013a.Raspberry Pi&#174;Gumstix&#174; Overo&#174;Digilent&#174; Analog Discovery&#8482;Kinect&#174; for Windows&#174;Some of you may know, especially if you've been reading some of the other blog posts, that we came out with our newest release of MATLAB R2013a last week. There are many new updates to [...]]]></description>
				<content:encoded><![CDATA[<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<style type="text/css">

h1 { font-size:18pt; }
h2.titlebg { font-size:13pt; }
h3 { color:#4A4F55; padding:0px; margin:5px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:11pt; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h4 { color:#4A4F55; padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:10pt; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
   
p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img { margin-bottom:0px; } 

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; background:none; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

pre, tt, code { font-size:12px; }
pre { margin:0px 0px 20px; }
pre.error { color:red; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }

  </style><div class="content"><p><a href="http://www.mathworks.com/matlabcentral/fileexchange/authors/15007">Jiro</a>'s pick this week is a collection of new hardware support packages introduced in R2013a.</p><div><ul><li><a href="http://www.mathworks.com/matlabcentral/fileexchange/40313">Raspberry Pi&reg;</a></li><li><a href="http://www.mathworks.com/matlabcentral/fileexchange/40273">Gumstix&reg; Overo&reg;</a></li><li><a href="http://www.mathworks.com/matlabcentral/fileexchange/40344">Digilent&reg; Analog Discovery&#8482;</a></li><li><a href="http://www.mathworks.com/matlabcentral/fileexchange/40445">Kinect&reg; for Windows&reg;</a></li></ul></div><p>Some of you may know, especially if you've been reading some of the other <a href="http://blogs.mathworks.com/">blog posts</a>, that we came out with our newest release of MATLAB <a href="http://www.mathworks.com/products/new_products/latest_features.html">R2013a</a> last week. There are many new updates to various Toolboxes, so check out the <a href="http://www.mathworks.com/help/relnotes/index.html">Release Notes</a>!</p><p>Since R2012a, we've been putting a lot of effort to make it easier for you to connect to different types of hardware, especially for use in academia. In R2012a, we added support for automatically running Simulink models on <a href="http://www.mathworks.com/academia/lego-mindstorms-nxt-software/">Lego&reg; Mindstorm&reg; NXT</a> and <a href="http://www.mathworks.com/academia/beagleboard/">BeagleBoard&#8482;</a>. In R2012b, we extended the capability to <a href="http://www.mathworks.com/academia/arduino-software/">Arduino&reg;</a> and <a href="http://www.mathworks.com/academia/pandaboard/">PandaBoard&#8482;</a>.</p><p>Now in R2013a, we have added support for <a href="http://www.mathworks.com/academia/raspberry-pi/">Raspberry Pi</a> and <a href="http://www.mathworks.com/academia/gumstix-overo/">Gumstix Overo</a>. In addition to these direct support within Simulink, the newest release contains support for <a href="http://www.mathworks.com/academia/digilent-analog-discovery/">Digilent Analog Discovery</a> with <a href="http://www.mathworks.com/products/daq/">Data Acquisition Toolbox</a>, and support for <a href="http://www.mathworks.com/academia/kinect/">Microsoft Kinect</a> with <a href="http://www.mathworks.com/products/imaq/">Image Acquisition Toolbox</a>.</p><p>You can start using these functionalities by downloading the installer files from the File Exchange, or, more conveniently, download directly from within MATLAB.</p><p><img vspace="5" hspace="5" src="http://blogs.mathworks.com/images/pick/jiro/potw_r2013aHWsupport/potw_getsupportpackages_screenshot.png" alt=""> </p><p>Read <a href="http://www.mathworks.com/academia/hardware-resources/index.html">more</a> about other hardware platforms you can interface with MATLAB and Simulink.</p><p><b>Comments</b></p><p>Have you used any of these hardware platforms with MATLAB and Simulink? Tell us about it <a href="http://blogs.mathworks.com/pick/?p=4430#respond">here</a>.</p><script language="JavaScript"> <!-- 
    function grabCode_c26df89ccef64a33a3367db3e6fd3d35() {
        // Remember the title so we can use it in the new page
        title = document.title;

        // Break up these strings so that their presence
        // in the Javascript doesn't mess up the search for
        // the MATLAB code.
        t1='c26df89ccef64a33a3367db3e6fd3d35 ' + '##### ' + 'SOURCE BEGIN' + ' #####';
        t2='##### ' + 'SOURCE END' + ' #####' + ' c26df89ccef64a33a3367db3e6fd3d35';
    
        b=document.getElementsByTagName('body')[0];
        i1=b.innerHTML.indexOf(t1)+t1.length;
        i2=b.innerHTML.indexOf(t2);
 
        code_string = b.innerHTML.substring(i1, i2);
        code_string = code_string.replace(/REPLACE_WITH_DASH_DASH/g,'--');

        // Use /x3C/g instead of the less-than character to avoid errors 
        // in the XML parser.
        // Use '\x26#60;' instead of '<' so that the XML parser
        // doesn't go ahead and substitute the less-than character. 
        code_string = code_string.replace(/\x3C/g, '\x26#60;');

        copyright = 'Copyright 2013 The MathWorks, Inc.';

        w = window.open();
        d = w.document;
        d.write('<pre>\n');
        d.write(code_string);

        // Add copyright line at the bottom if specified.
        if (copyright.length > 0) {
            d.writeln('');
            d.writeln('%%');
            if (copyright.length > 0) {
                d.writeln('% _' + copyright + '_');
            }
        }

        d.write('</pre>\n');

        d.title = title + ' (MATLAB code)';
        d.close();
    }   
     --> </script><p style="text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray"><br /><a href="javascript:grabCode_c26df89ccef64a33a3367db3e6fd3d35()"><span style="font-size: x-small;        font-style: italic;">Get 
      the MATLAB code <noscript>(requires JavaScript)</noscript></span></a><br /><br />
      Published with MATLAB&reg; R2013a<br /></p><p class="footer"><br />
      Published with MATLAB&reg; R2013a<br /></p></div><!--
c26df89ccef64a33a3367db3e6fd3d35 ##### SOURCE BEGIN #####
%%
% <http://www.mathworks.com/matlabcentral/fileexchange/authors/15007
% Jiro>'s pick this week is a collection of new hardware support packages
% introduced in R2013a.
%
% * <http://www.mathworks.com/matlabcentral/fileexchange/40313 Raspberry
% PiÂ®>
% * <http://www.mathworks.com/matlabcentral/fileexchange/40273 GumstixÂ®
% OveroÂ®>
% * <http://www.mathworks.com/matlabcentral/fileexchange/40344 DigilentÂ®
% Analog Discoveryâ„¢>
% * <http://www.mathworks.com/matlabcentral/fileexchange/40445 KinectÂ® for
% WindowsÂ®>
%
% Some of you may know, especially if you've been reading some of the other
% <http://blogs.mathworks.com/ blog posts>, that we came out with our
% newest release of MATLAB
% <http://www.mathworks.com/products/new_products/latest_features.html
% R2013a> last week. There are many new updates to various Toolboxes, so
% check out the <http://www.mathworks.com/help/relnotes/index.html Release
% Notes>!
%
% Since R2012a, we've been putting a lot of effort to make it easier for
% you to connect to different types of hardware, especially for use in
% academia. In R2012a, we added support for automatically running Simulink
% models on
% <http://www.mathworks.com/academia/lego-mindstorms-nxt-software/ LegoÂ®
% MindstormÂ® NXT> and <http://www.mathworks.com/academia/beagleboard/
% BeagleBoardâ„¢>. In R2012b, we extended the capability to
% <http://www.mathworks.com/academia/arduino-software/ ArduinoÂ®> and
% <http://www.mathworks.com/academia/pandaboard/ PandaBoardâ„¢>.
%
% Now in R2013a, we have added support for
% <http://www.mathworks.com/academia/raspberry-pi/ Raspberry Pi> and
% <http://www.mathworks.com/academia/gumstix-overo/ Gumstix Overo>. In
% addition to these direct support within Simulink, the newest release
% contains support for
% <http://www.mathworks.com/academia/digilent-analog-discovery/ Digilent
% Analog Discovery> with <http://www.mathworks.com/products/daq/ Data
% Acquisition Toolbox>, and support for
% <http://www.mathworks.com/academia/kinect/ Microsoft Kinect> with
% <http://www.mathworks.com/products/imaq/ Image Acquisition Toolbox>.
%
% You can start using these functionalities by downloading the installer
% files from the File Exchange, or, more conveniently, download directly
% from within MATLAB.
%
% <<potw_getsupportpackages_screenshot.png>>
%
% Read <http://www.mathworks.com/academia/hardware-resources/index.html
% more> about other hardware platforms you can interface with MATLAB and
% Simulink.
%
% *Comments*
%
% Have you used any of these hardware platforms with MATLAB and Simulink?
% Tell us about it <http://blogs.mathworks.com/pick/?p=4430#respond here>.

##### SOURCE END ##### c26df89ccef64a33a3367db3e6fd3d35
-->]]></content:encoded>
			<wfw:commentRss>http://blogs.mathworks.com/pick/2013/03/15/additional-hardware-support-in-r2013a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
