<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: What&#8217;s in Your startup.m?</title>
	<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/</link>
	<description>Loren Shure  works on design of the MATLAB language at &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62;. She writes here about once a week on MATLAB programming and related topics. &#60;br&#62;&#60;br&#62;&#60;a href="/images/loren-full.jpg"&#62;&#60;img src="/images/loren.jpg"&#62;&#60;/a&#62;</description>
	<pubDate>Sun, 22 Nov 2009 22:59:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Les</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30778</link>
		<dc:creator>Les</dc:creator>
		<pubDate>Fri, 13 Nov 2009 05:57:51 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30778</guid>
		<description>One of the main things I use startup.m for is to turn on grid lines by default.  As another poster commented: why isn't this the default (or at least an option configurable without having to put these commands in the startup.m script)?

I also use it to set the MATLABROOT environment variable to correspond to the version of Matlab that has just been invoked.

I use this environment variable in Makefiles for S-function builds.  This allows using the same Makefile for use with multiple Matlab versions without manual editing of the Makefile.  

This requires the use of the setx utility from Microsoft's "Windows XP Service Pack 2 Support Tools" which allows setting system environment variables.  The support tools pack can be downloaded from:

http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38&#38;DisplayLang=en

Here is the operative portion of my startup.m:

&lt;pre&gt;
% Turn grid lines on by default
set(0, 'defaultAxesXGrid', 'on')
set(0, 'defaultAxesYGrid', 'on')
set(0, 'defaultAxesZGrid', 'on')

% Set the MATLABROOT environment variable if it is not set correctly or
% it does not exist
if (~isequal(getenv('MATLABROOT'), matlabroot))
    fprintf('Updating MATLABROOT environment variable\n\n');
    result = dos(['setx MATLABROOT "' matlabroot '"']);
    if (result ~= 0)
        fprintf(['\nError setting MATLABROOT environment variable.  ', ...
            'You may not have the setx utility installed.\n'...
            'See the help below:\n\n']);
        help startup
    end        
end
clear result
&lt;/pre&gt;

-Les</description>
		<content:encoded><![CDATA[<p>One of the main things I use startup.m for is to turn on grid lines by default.  As another poster commented: why isn&#8217;t this the default (or at least an option configurable without having to put these commands in the startup.m script)?</p>
<p>I also use it to set the MATLABROOT environment variable to correspond to the version of Matlab that has just been invoked.</p>
<p>I use this environment variable in Makefiles for S-function builds.  This allows using the same Makefile for use with multiple Matlab versions without manual editing of the Makefile.  </p>
<p>This requires the use of the setx utility from Microsoft&#8217;s &#8220;Windows XP Service Pack 2 Support Tools&#8221; which allows setting system environment variables.  The support tools pack can be downloaded from:</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38&amp;DisplayLang=en" rel="nofollow">http://www.microsoft.com/downloads/details.aspx?FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38&amp;DisplayLang=en</a></p>
<p>Here is the operative portion of my startup.m:</p>
<pre>
% Turn grid lines on by default
set(0, 'defaultAxesXGrid', 'on')
set(0, 'defaultAxesYGrid', 'on')
set(0, 'defaultAxesZGrid', 'on')

% Set the MATLABROOT environment variable if it is not set correctly or
% it does not exist
if (~isequal(getenv('MATLABROOT'), matlabroot))
    fprintf('Updating MATLABROOT environment variable\n\n');
    result = dos(['setx MATLABROOT "' matlabroot '"']);
    if (result ~= 0)
        fprintf(['\nError setting MATLABROOT environment variable.  ', ...
            'You may not have the setx utility installed.\n'...
            'See the help below:\n\n']);
        help startup
    end
end
clear result
</pre>
<p>-Les</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30775</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Thu, 12 Nov 2009 20:11:43 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30775</guid>
		<description>OysterEngineer-

The setting of defaults is documented in one place for all of graphics.  It's not specific to any of the graphics primitives, but appropriate for all of them.  I'm guessing the thinking was that it would bloat the documentation to mention setting different defaults in each FRP.  But I will pass along your thoughts on this.   

O is indeed the root level.

Thanks for your thoughtful comments on the documentation.  Again, I will pass them along.

--Loren</description>
		<content:encoded><![CDATA[<p>OysterEngineer-</p>
<p>The setting of defaults is documented in one place for all of graphics.  It&#8217;s not specific to any of the graphics primitives, but appropriate for all of them.  I&#8217;m guessing the thinking was that it would bloat the documentation to mention setting different defaults in each FRP.  But I will pass along your thoughts on this.   </p>
<p>O is indeed the root level.</p>
<p>Thanks for your thoughtful comments on the documentation.  Again, I will pass them along.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OysterEngineer</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30773</link>
		<dc:creator>OysterEngineer</dc:creator>
		<pubDate>Thu, 12 Nov 2009 19:23:38 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30773</guid>
		<description>This post was really handy just because I learned how to default the grid on.

Here is my question: Why isn't this capability default setting capability mentioned in the FRP for grid?  Instead, it is buried 3 layers deep in the general discussion of Graphics.

Also, what does it mean when the 1st example sets a default for the gcf, while a few lines later is says, "It is meaningful to specify a default figure color only on the root level."?  In your example, I guess you are setting grid to on at the root level, assuming that a handle value of 0 is the same as the root level.

Once I found the appropriate page of documentation, I did a search for "Defining Default Values," and the 1st search result that was returned was under the broad topic of Object-Oriented Programming.  This documentation miss-directed me in that the style for setting default values in the world of OOP is different than the world of Handle Graphics.

Let me turn this around a bit: List the series of documentation that I needed to read so I could have learned all I needed to know to generate your above command just from reading the documentation.

By the way, this encounter with the non-FRP documentation took me to the nice hot-link populated tree discussing Handle Graphic Object Properties.  This section of documentation illustrates very strongly the shortcoming &#38; complexity of MatLab's graphic process.</description>
		<content:encoded><![CDATA[<p>This post was really handy just because I learned how to default the grid on.</p>
<p>Here is my question: Why isn&#8217;t this capability default setting capability mentioned in the FRP for grid?  Instead, it is buried 3 layers deep in the general discussion of Graphics.</p>
<p>Also, what does it mean when the 1st example sets a default for the gcf, while a few lines later is says, &#8220;It is meaningful to specify a default figure color only on the root level.&#8221;?  In your example, I guess you are setting grid to on at the root level, assuming that a handle value of 0 is the same as the root level.</p>
<p>Once I found the appropriate page of documentation, I did a search for &#8220;Defining Default Values,&#8221; and the 1st search result that was returned was under the broad topic of Object-Oriented Programming.  This documentation miss-directed me in that the style for setting default values in the world of OOP is different than the world of Handle Graphics.</p>
<p>Let me turn this around a bit: List the series of documentation that I needed to read so I could have learned all I needed to know to generate your above command just from reading the documentation.</p>
<p>By the way, this encounter with the non-FRP documentation took me to the nice hot-link populated tree discussing Handle Graphic Object Properties.  This section of documentation illustrates very strongly the shortcoming &amp; complexity of MatLab&#8217;s graphic process.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oscar</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30612</link>
		<dc:creator>Oscar</dc:creator>
		<pubDate>Tue, 15 Sep 2009 17:47:40 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30612</guid>
		<description>Thanks Daniel, that is so cool, have been wondering why the mathworks guys have never added an option to do that.</description>
		<content:encoded><![CDATA[<p>Thanks Daniel, that is so cool, have been wondering why the mathworks guys have never added an option to do that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anne</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30544</link>
		<dc:creator>Anne</dc:creator>
		<pubDate>Thu, 20 Aug 2009 17:44:24 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30544</guid>
		<description>Thank you everyone for the code to save and reload the editor state. I've been looking for a way to do this. It is very helpful.</description>
		<content:encoded><![CDATA[<p>Thank you everyone for the code to save and reload the editor state. I&#8217;ve been looking for a way to do this. It is very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30367</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Fri, 05 Jun 2009 00:04:21 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30367</guid>
		<description>The problem was that there is a comma missing in the command save ( 'editorState.mat', editorState' ); 

i.e. it should read as follows:
save ( 'editorState.mat', 'editorState' );

It works for me now. This will prove to be very useful.</description>
		<content:encoded><![CDATA[<p>The problem was that there is a comma missing in the command save ( &#8216;editorState.mat&#8217;, editorState&#8217; ); </p>
<p>i.e. it should read as follows:<br />
save ( &#8216;editorState.mat&#8217;, &#8216;editorState&#8217; );</p>
<p>It works for me now. This will prove to be very useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30348</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Wed, 03 Jun 2009 06:32:38 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30348</guid>
		<description>Martin,

I think you've used cut+paste from your web browser and ended up with some fancy typographic quotes.  Retype the commands in the Matlab editor which doesn't silently replace quotes, and things should get better.

And to get back on topic, I like to include all plot customizations and so forth in the script that creates the plot, then if I go back and remake a plot I'll get the same result, whereas if I put all of that into startup.m then every time I made changes I'd end up changing the behavior of my existing scripts.</description>
		<content:encoded><![CDATA[<p>Martin,</p>
<p>I think you&#8217;ve used cut+paste from your web browser and ended up with some fancy typographic quotes.  Retype the commands in the Matlab editor which doesn&#8217;t silently replace quotes, and things should get better.</p>
<p>And to get back on topic, I like to include all plot customizations and so forth in the script that creates the plot, then if I go back and remake a plot I&#8217;ll get the same result, whereas if I put all of that into startup.m then every time I made changes I&#8217;d end up changing the behavior of my existing scripts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30346</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 02 Jun 2009 10:57:57 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30346</guid>
		<description>Martin and Per-

I wonder if you can work this out off-line and then post the solution.

--Loren</description>
		<content:encoded><![CDATA[<p>Martin and Per-</p>
<p>I wonder if you can work this out off-line and then post the solution.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30344</link>
		<dc:creator>Martin</dc:creator>
		<pubDate>Mon, 01 Jun 2009 23:46:38 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30344</guid>
		<description>/per

I tried that and got this new error:

??? Error using ==&#62; save
Argument must contain a string.

Error in ==&#62; saved_editor_space1 at 8
save ( 'editorState.mat', editorState' );</description>
		<content:encoded><![CDATA[<p>/per</p>
<p>I tried that and got this new error:</p>
<p>??? Error using ==&gt; save<br />
Argument must contain a string.</p>
<p>Error in ==&gt; saved_editor_space1 at 8<br />
save ( &#8216;editorState.mat&#8217;, editorState&#8217; );</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: per isakson</title>
		<link>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30342</link>
		<dc:creator>per isakson</dc:creator>
		<pubDate>Fri, 29 May 2009 12:39:22 +0000</pubDate>
		<guid>http://blogs.mathworks.com/loren/2009/03/03/whats-in-your-startupm/#comment-30342</guid>
		<description>Hi Martin

Try adding 

&lt;pre&gt;
editorState = cellstr( char( editorState ) );
&lt;/pre&gt;

to convert the Java string to a cell array of strings. 
In R2208a save cannot handle Java strings.

/per</description>
		<content:encoded><![CDATA[<p>Hi Martin</p>
<p>Try adding </p>
<pre>
editorState = cellstr( char( editorState ) );
</pre>
<p>to convert the Java string to a cell array of strings.<br />
In R2208a save cannot handle Java strings.</p>
<p>/per</p>
]]></content:encoded>
	</item>
</channel>
</rss>
