<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	>
<channel>
	<title>Comments on: Accessing the Matlab Editor</title>
	<atom:link href="http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/feed/" rel="self" type="application/rss+xml" />
	<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/</link>
	<description>Charting Matlab's unsupported hidden underbelly</description>
	<pubDate>Fri, 12 Mar 2010 16:59:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-7807</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Wed, 03 Mar 2010 17:51:44 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-7807</guid>
		<description>@Jan - I'm willing to bet that the solution for 6.5 is simply a variant of the Matlab 6 syntax. Try to run the following command in Matlab 6.5 to check whether the getOpenDocuments() method was renamed:

&lt;pre lang="matlab"&gt;
methodsview('com.mathworks.ide.editor.EditorApplication')
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>@Jan - I&#8217;m willing to bet that the solution for 6.5 is simply a variant of the Matlab 6 syntax. Try to run the following command in Matlab 6.5 to check whether the getOpenDocuments() method was renamed:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">methodsview<span style="color: #080;">&#40;</span><span style="color:#A020F0;">'com.mathworks.ide.editor.EditorApplication'</span><span style="color: #080;">&#41;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Simon</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-7805</link>
		<dc:creator>Jan Simon</dc:creator>
		<pubDate>Wed, 03 Mar 2010 17:37:50 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-7805</guid>
		<description>This does not work on my Matlab 6.5.1, WinXP SP3, JavaVM 1.3.1_01
&lt;pre lang="matlab"&gt;
% So here's the workaround for Matlab 6:
openDocs = com.mathworks.ide.editor.EditorApplication.getOpenDocuments;
&lt;/pre&gt;
There is no getOpenDocuments method for the EditorApplication.
The solution is trivial: Do not use Matlab 6.5...  Thanks, Jan</description>
		<content:encoded><![CDATA[<p>This does not work on my Matlab 6.5.1, WinXP SP3, JavaVM 1.3.1_01</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #228B22;">% So here's the workaround for Matlab 6:</span>
openDocs = com.<span style="">mathworks</span>.<span style="">ide</span>.<span style="">editor</span>.<span style="">EditorApplication</span>.<span style="">getOpenDocuments</span>;</pre></div></div>

<p>There is no getOpenDocuments method for the EditorApplication.<br />
The solution is trivial: Do not use Matlab 6.5&#8230;  Thanks, Jan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-7787</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Wed, 03 Mar 2010 07:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-7787</guid>
		<description>For anyone interested, Jan Simon has just &lt;a target=_blank rel=nofollow href=http://www.mathworks.com/matlabcentral/newsreader/view_thread/275241#722832 rel="nofollow"&gt;posted&lt;/a&gt; a few more useful things that can be done using the Editor handle:

Bring the editor to front:
&lt;pre lang="matlab"&gt;jEditor.toFront;&lt;/pre&gt;

Is the editor active currently:
&lt;pre lang="matlab"&gt;jEditor.isActive;&lt;/pre&gt;

Perform an action whenever the user activate the editor:
&lt;pre lang="matlab"&gt;set(jEditor, 'WindowGainFocusCallback', 'disp(''Editor activated'')')&lt;/pre&gt;
Or the usual function handle callback style.

See further properties:
&lt;pre lang="matlab"&gt;get(jEditor)&lt;/pre&gt;
and
&lt;pre lang="matlab"&gt;methods(jEditor, '-full')&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>For anyone interested, Jan Simon has just <a target=_blank rel=nofollow href=http://www.mathworks.com/matlabcentral/newsreader/view_thread/275241#722832 rel="nofollow">posted</a> a few more useful things that can be done using the Editor handle:</p>
<p>Bring the editor to front:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">jEditor.<span style="">toFront</span>;</pre></div></div>

<p>Is the editor active currently:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">jEditor.<span style="">isActive</span>;</pre></div></div>

<p>Perform an action whenever the user activate the editor:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>jEditor, <span style="color:#A020F0;">'WindowGainFocusCallback'</span>, <span style="color:#A020F0;">'disp('</span><span style="color:#A020F0;">'Editor activated'</span><span style="color:#A020F0;">')'</span><span style="color: #080;">&#41;</span></pre></div></div>

<p>Or the usual function handle callback style.</p>
<p>See further properties:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>jEditor<span style="color: #080;">&#41;</span></pre></div></div>

<p>and</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">methods</span><span style="color: #080;">&#40;</span>jEditor, <span style="color:#A020F0;">'-full'</span><span style="color: #080;">&#41;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Arthington</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-7005</link>
		<dc:creator>Matthew Arthington</dc:creator>
		<pubDate>Mon, 08 Feb 2010 16:03:59 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-7005</guid>
		<description>My editor window is docked and that stops title being the 'Editor - '... form. I wanted to get the active document so I could invoke a command to open the directory of the current editor's file. 

Thanks to Aurélien I discovered the following to get the current editor's file path:

&lt;pre lang="matlab"&gt;
d = com.mathworks.mlservices.MLEditorServices;
fName = d.builtinGetActiveDocument;
path=fileparts(fName.toCharArray');
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>My editor window is docked and that stops title being the &#8216;Editor - &#8216;&#8230; form. I wanted to get the active document so I could invoke a command to open the directory of the current editor&#8217;s file. </p>
<p>Thanks to Aurélien I discovered the following to get the current editor&#8217;s file path:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">d = com.<span style="">mathworks</span>.<span style="">mlservices</span>.<span style="">MLEditorServices</span>;
fName = d.<span style="">builtinGetActiveDocument</span>;
<span style="color: #0000FF;">path</span>=<span style="color: #0000FF;">fileparts</span><span style="color: #080;">&#40;</span>fName.<span style="">toCharArray</span>'<span style="color: #080;">&#41;</span>;</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Katz</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-3536</link>
		<dc:creator>Mike Katz</dc:creator>
		<pubDate>Mon, 26 Oct 2009 13:10:32 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-3536</guid>
		<description>@Aurélien, in MATLAB &gt;= R2009b you can try 
&lt;pre lang="matlab"&gt;editorservices.closeGroup&lt;/pre&gt;
And to leave the group up and just close all the open editors
&lt;pre lang="matlab"&gt;e=editorservices.getAll; e.close&lt;/pre&gt;

For more about the "less undocumented" way to access the editor, see my new post:
&lt;a href="http://blogs.mathworks.com/desktop/2009/10/26/the-matlab-editor-at-your-fingertips/" rel="nofollow"&gt;http://blogs.mathworks.com/desktop/2009/10/26/the-matlab-editor-at-your-fingertips/&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>@Aurélien, in MATLAB &gt;= R2009b you can try</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">editorservices.<span style="">closeGroup</span></pre></div></div>

<p>And to leave the group up and just close all the open editors</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">e=editorservices.<span style="">getAll</span>; e.<span style="color: #0000FF;">close</span></pre></div></div>

<p>For more about the &#8220;less undocumented&#8221; way to access the editor, see my new post:<br />
<a href="http://blogs.mathworks.com/desktop/2009/10/26/the-matlab-editor-at-your-fingertips/" rel="nofollow">http://blogs.mathworks.com/desktop/2009/10/26/the-matlab-editor-at-your-fingertips/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yair Altman</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-3462</link>
		<dc:creator>Yair Altman</dc:creator>
		<pubDate>Sat, 24 Oct 2009 22:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-3462</guid>
		<description>Ruben - that was a hard question that kept me digging for hours. I discovered (via the &lt;b&gt;&lt;i&gt;FindJObj&lt;/i&gt;&lt;/b&gt; utility) that the bookmarks are displayed in a panel called 'ExecutionArrowDisplay' of class com.mathworks.mde.editor.ExecutionArrowDisplay$ExecutionPanel. I do not know whether the list of bookmarks are contained within this object, although I suspect they are. In any case, I did not find a method to programmatically retrieve this list since the ExecutionPanel object does not expose any method to do so. 

So, the only way I could find is to loop over all the editor's open files, and invoke the editor's default action for &lt;F2&gt; (which is the 'next-bookmark' action reported by the &lt;b&gt;&lt;i&gt;EditorMacro&lt;/i&gt;&lt;/b&gt; utility) in a loop until you detect coming back to an earlier line number. It's ugly, but it should work. The reverse, setting bookmarks, could be done in a similar fashion, using the 'toggle-bookmark' action.

I think it could be a great File Exchange utility. Care to try it? If you get stuck I can help out.</description>
		<content:encoded><![CDATA[<p>Ruben - that was a hard question that kept me digging for hours. I discovered (via the <b><i>FindJObj</i></b> utility) that the bookmarks are displayed in a panel called &#8216;ExecutionArrowDisplay&#8217; of class com.mathworks.mde.editor.ExecutionArrowDisplay$ExecutionPanel. I do not know whether the list of bookmarks are contained within this object, although I suspect they are. In any case, I did not find a method to programmatically retrieve this list since the ExecutionPanel object does not expose any method to do so. </p>
<p>So, the only way I could find is to loop over all the editor&#8217;s open files, and invoke the editor&#8217;s default action for &lt;F2&gt; (which is the &#8216;next-bookmark&#8217; action reported by the <b><i>EditorMacro</i></b> utility) in a loop until you detect coming back to an earlier line number. It&#8217;s ugly, but it should work. The reverse, setting bookmarks, could be done in a similar fashion, using the &#8216;toggle-bookmark&#8217; action.</p>
<p>I think it could be a great File Exchange utility. Care to try it? If you get stuck I can help out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ruben Faibish</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-3433</link>
		<dc:creator>Ruben Faibish</dc:creator>
		<pubDate>Fri, 23 Oct 2009 13:07:20 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-3433</guid>
		<description>Do you know how can I find the bookmarks in the editor? I would like to get all bookmarks and save them on closing Matlab, so that on reopening, they could be restored.
Thx</description>
		<content:encoded><![CDATA[<p>Do you know how can I find the bookmarks in the editor? I would like to get all bookmarks and save them on closing Matlab, so that on reopening, they could be restored.<br />
Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aurélien Queffurust</title>
		<link>http://undocumentedmatlab.com/blog/accessing-the-matlab-editor/comment-page-1/#comment-3365</link>
		<dc:creator>Aurélien Queffurust</dc:creator>
		<pubDate>Tue, 20 Oct 2009 14:37:54 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-3365</guid>
		<description>To close all M-files in the editor, I use:
 &lt;pre lang="matlab"&gt;

com.mathworks.mlservices.MLEditorServices.closeAll
   &lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>To close all M-files in the editor, I use:</p>

<div class="wp_syntax"><div class="code"><pre class="matlab" style="font-family:monospace;">&nbsp;
com.<span style="">mathworks</span>.<span style="">mlservices</span>.<span style="">MLEditorServices</span>.<span style="">closeAll</span></pre></div></div>

]]></content:encoded>
	</item>
</channel>
</rss>
