<?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="https://undocumentedmatlab.com/articles/accessing-the-matlab-editor/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=accessing-the-matlab-editor</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Tue, 21 Mar 2017 11:23:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>
		By: Prajakta		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-403428</link>

		<dc:creator><![CDATA[Prajakta]]></dc:creator>
		<pubDate>Tue, 21 Mar 2017 11:23:00 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-403428</guid>

					<description><![CDATA[Thank you for your reply sir!

the thing is strfind or strrep wont detect the inconsistency i am talking about. It shows error something like this:

&#062;&#062; ans{1,1}

ans =

F@@@@@@@@@@@@@@@7

&#062;&#062; strrep (ans, &#039;@@@@@@@@@@@@@@@@&#039;,&#039;&#039;);
 strrep (ans, &#039;@@@@@@@@@@@@@@@&#039;,&#039;&#039;);
              ↑
Error: String is not terminated properly.
 
&#062;&#062;]]></description>
			<content:encoded><![CDATA[<p>Thank you for your reply sir!</p>
<p>the thing is strfind or strrep wont detect the inconsistency i am talking about. It shows error something like this:</p>
<p>&gt;&gt; ans{1,1}</p>
<p>ans =</p>
<p>F@@@@@@@@@@@@@@@7</p>
<p>&gt;&gt; strrep (ans, &#8216;@@@@@@@@@@@@@@@@&#8217;,&#8221;);<br />
 strrep (ans, &#8216;@@@@@@@@@@@@@@@&#8217;,&#8221;);<br />
              ↑<br />
Error: String is not terminated properly.</p>
<p>&gt;&gt;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-403420</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 21 Mar 2017 07:43:21 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-403420</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-403415&quot;&gt;Prajakta&lt;/a&gt;.

use the &lt;code&gt;strrep&lt;/code&gt; function]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-403415">Prajakta</a>.</p>
<p>use the <code>strrep</code> function</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Prajakta		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-403415</link>

		<dc:creator><![CDATA[Prajakta]]></dc:creator>
		<pubDate>Tue, 21 Mar 2017 05:57:06 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-403415</guid>

					<description><![CDATA[Dear Yair,
I am using MatLab 2016a. Right now I am working on analyzing raw EEG data from emotiv epoc headset. Sometimes when I extract data from the headset, some inconsistencies come along with sensor values. I need to remove these to get clean data. I can use &#039;Find and Replace&#039; icon for that. But I want to script this task in my program so that I dont have to do it manually every time. 
I need to script &#039; Find and Replace&#039; icon in the editor window. Could you please help!
Thank you.]]></description>
			<content:encoded><![CDATA[<p>Dear Yair,<br />
I am using MatLab 2016a. Right now I am working on analyzing raw EEG data from emotiv epoc headset. Sometimes when I extract data from the headset, some inconsistencies come along with sensor values. I need to remove these to get clean data. I can use &#8216;Find and Replace&#8217; icon for that. But I want to script this task in my program so that I dont have to do it manually every time.<br />
I need to script &#8216; Find and Replace&#8217; icon in the editor window. Could you please help!<br />
Thank you.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ondrej		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-401616</link>

		<dc:creator><![CDATA[Ondrej]]></dc:creator>
		<pubDate>Thu, 02 Mar 2017 09:40:08 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-401616</guid>

					<description><![CDATA[Dear Yair,

I am using pretty old version of Matlab 7.6.0 (R2008a) and I noticed that there is a file named &lt;i&gt;mfiletemplate.m&lt;/i&gt; in &lt;code&gt;toolbox/matlab/codetools/.&lt;/code&gt;

I suspect that it should be used for templating a new file, i.e., I click on the New M-File and it shows a new m-file with some template (containing copyrights, etc.). However, it seems it is never called and I can&#039;t find any documentation about this function. Do you know this function and how is it used?

In general, my problem is, that I would like to create an m-file containing some header each time I click on New M-file icon. I can do that using custom shortcuts (there is plenty of codes on fileexchange), but the main problem is that the custom shortcuts are not visible in editor window (only desktop). Is there probably a way to &quot;hack&quot; the new m-file icon that it would call my own script?
Thank you a lot.]]></description>
			<content:encoded><![CDATA[<p>Dear Yair,</p>
<p>I am using pretty old version of Matlab 7.6.0 (R2008a) and I noticed that there is a file named <i>mfiletemplate.m</i> in <code>toolbox/matlab/codetools/.</code></p>
<p>I suspect that it should be used for templating a new file, i.e., I click on the New M-File and it shows a new m-file with some template (containing copyrights, etc.). However, it seems it is never called and I can&#8217;t find any documentation about this function. Do you know this function and how is it used?</p>
<p>In general, my problem is, that I would like to create an m-file containing some header each time I click on New M-file icon. I can do that using custom shortcuts (there is plenty of codes on fileexchange), but the main problem is that the custom shortcuts are not visible in editor window (only desktop). Is there probably a way to &#8220;hack&#8221; the new m-file icon that it would call my own script?<br />
Thank you a lot.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-391135</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 20 Oct 2016 17:25:42 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-391135</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-390746&quot;&gt;Royi&lt;/a&gt;.

@Royi - &lt;i&gt;setBounds&lt;/i&gt; is not a field but a method (that accepts either a &lt;code&gt;java.awt.Rectangle&lt;/code&gt; object or 4 &lt;code&gt;int&lt;/code&gt; values as input parameter(s)). As far as I can tell, it still exists in R2016a, you simply have a usage bug in your code.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-390746">Royi</a>.</p>
<p>@Royi &#8211; <i>setBounds</i> is not a field but a method (that accepts either a <code>java.awt.Rectangle</code> object or 4 <code>int</code> values as input parameter(s)). As far as I can tell, it still exists in R2016a, you simply have a usage bug in your code.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Royi		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-390746</link>

		<dc:creator><![CDATA[Royi]]></dc:creator>
		<pubDate>Sat, 15 Oct 2016 10:53:53 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-390746</guid>

					<description><![CDATA[Hello,

It seems something changed lately (At least on MATLAB R2016a).
For most methods (Such as changing the bounds / size properties) I get the following error (This case for setBounds):

No public field setBounds exists for class com.mathworks.mde.desk.MLMultipleClientFrame.

How can one now access those properties?

One could still edit some of the properties by:

inspect(jEditor).

Thank You.]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>It seems something changed lately (At least on MATLAB R2016a).<br />
For most methods (Such as changing the bounds / size properties) I get the following error (This case for setBounds):</p>
<p>No public field setBounds exists for class com.mathworks.mde.desk.MLMultipleClientFrame.</p>
<p>How can one now access those properties?</p>
<p>One could still edit some of the properties by:</p>
<p>inspect(jEditor).</p>
<p>Thank You.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Andrew Joslin		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-385045</link>

		<dc:creator><![CDATA[Andrew Joslin]]></dc:creator>
		<pubDate>Fri, 05 Aug 2016 17:35:57 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-385045</guid>

					<description><![CDATA[Hi Yair,

I&#039;m writing a function in Matlab that will auto-generate header information for a Matlab .m file using key-phrases and context throughout the file.  It would be great if I could also auto-wrap comments programmatically, do you know of a way to do this either through Matlab&#039;s matlab.desktop.editor class or the Java classes discussed on this page?  Ideally, it would be equivalent to manually selecting text in the editor, then pressing CTRL+J to wrap any selected comments.

Thank you for this website, it&#039;s been helpful on many occasions!]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>I&#8217;m writing a function in Matlab that will auto-generate header information for a Matlab .m file using key-phrases and context throughout the file.  It would be great if I could also auto-wrap comments programmatically, do you know of a way to do this either through Matlab&#8217;s matlab.desktop.editor class or the Java classes discussed on this page?  Ideally, it would be equivalent to manually selecting text in the editor, then pressing CTRL+J to wrap any selected comments.</p>
<p>Thank you for this website, it&#8217;s been helpful on many occasions!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Martin WH		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-374670</link>

		<dc:creator><![CDATA[Martin WH]]></dc:creator>
		<pubDate>Tue, 19 Apr 2016 10:51:45 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-374670</guid>

					<description><![CDATA[I&#039;d like to generate a warning when I close the MATLAB editor. Any ideas how one would go about achieving this?]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to generate a warning when I close the MATLAB editor. Any ideas how one would go about achieving this?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-362734</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 28 Nov 2015 19:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-362734</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-362726&quot;&gt;C.Alberto&lt;/a&gt;.

@Alberto - try &lt;code&gt;&lt;a href=&quot;http://undocumentedmatlab.com/blog/syntax-highlighted-labels-panels#SyntaxTextPane&quot; rel=&quot;nofollow&quot;&gt;SyntaxTextPane&lt;/a&gt;&lt;/code&gt;.

If you liked my book, please be kind enough to post a favorable review of it in Amazon (&lt;a target=&quot;_blank&quot; href=&quot;http://amazon.com/Undocumented-Secrets-MATLAB-Java-Programming-Altman/product-reviews/1439869030/ref=cm_cr_dp_see_all_summary&quot; rel=&quot;nofollow&quot;&gt;link&lt;/a&gt;)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-362726">C.Alberto</a>.</p>
<p>@Alberto &#8211; try <code><a href="http://undocumentedmatlab.com/blog/syntax-highlighted-labels-panels#SyntaxTextPane" rel="nofollow">SyntaxTextPane</a></code>.</p>
<p>If you liked my book, please be kind enough to post a favorable review of it in Amazon (<a target="_blank" href="http://amazon.com/Undocumented-Secrets-MATLAB-Java-Programming-Altman/product-reviews/1439869030/ref=cm_cr_dp_see_all_summary" rel="nofollow">link</a>)</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: C.Alberto		</title>
		<link>https://undocumentedmatlab.com/articles/accessing-the-matlab-editor#comment-362726</link>

		<dc:creator><![CDATA[C.Alberto]]></dc:creator>
		<pubDate>Sat, 28 Nov 2015 17:30:51 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=671#comment-362726</guid>

					<description><![CDATA[Hi Yair,

Many thanks for your (un)documented work and book.

Here  is my question:

[SHORT]
Is there an easy way to emulate the in &#039;block&#039; C code editing
that is available in the &quot;Embedded Matlab Function&quot; (SimulinkBlock).

[MORE Detailed]
I was using the old &lt;code&gt;JSyntaxPane&lt;/code&gt; Java library, to call for inline editing of hidden block userdata field, and to replace the ugly Usercode blocks managed by the &quot;ccextopenfcn&quot;.

However, &lt;code&gt;JSyntexPane&lt;/code&gt; Lib is now a bit obsoleted and not more maintained. Therefore I was intended to replace it with more efficient and portable &lt;code&gt;EmbeddedMatlabEditor&lt;/code&gt;, thus minimizing also external java dependencies.

Using the post guidance it is easy to open the Docs and flush some actions, but I did not found clear methods to switch syntax parsing to &quot;C&quot; and  to intercept the file saving actions (even if a save interceptor method exist in the &lt;code&gt;com.mathworks.mde.editor.MatlabEditorApplication&lt;/code&gt;)

Thank you again for your work.

[EVEN MORE]
Here is an example how I integrated the JSyntax

&lt;pre lang=&quot;matlab&quot;&gt;
function [r,ok] = coloreditjava(s, Title)
import javax.swing.*

% First we create a new Figure with some properties for better look
fa = figure(&#039;NumberTitle&#039;,&#039;off&#039;,&#039;Name&#039;,[&#039;SF: &#039; Title],&#039;DockControls&#039;,&#039;on&#039;,...
&#039;Toolbar&#039;,&#039;none&#039;,&#039;Menubar&#039;,&#039;none&#039;);
sz=get(fa,&#039;OuterPosition&#039;);
set(fa,&#039;OuterPosition&#039;,[sz(1)-340 sz(2)-300 680 730]);
 
% JSYNTAX pane is an external JAR library which handles a color
% editing textbox. The box is similar in functionalities to 
% scintilla, but the use of java here makes the tool portable
% among different platforms (OSX/WIN7 tested)
jsyntaxpane.DefaultSyntaxKit.initKit();
codeEditor = JEditorPane();
% We used the default language as JAVA since is similar to 
% C and the &#039;C&#039; color editing is not mature enough in the
% external toolbox
codeEditor.setContentType(&#039;text/java&#039;);
%codeEditor.read(java.io.StringReader(s), &#039;text/java&#039;);

% Secondly we attach and resize this widget to our figure
% we reserve 25 points edge alonside
srcPane = JScrollPane(codeEditor);
[jEdit,EditContainer] = javacomponent(srcPane, [20,40,640,700], fa);
set(fa, &#039;ResizeFcn&#039;,{@myResize, EditContainer});
codeEditor.setEditorKit(jsyntaxpane.syntaxkits.JavaSyntaxKit());
codeEditor.setText(char(s));        

% on the bottom we attached two Java buttons which are defined on the
% fly. Any java swing component may be used here. This is not
% officially supported matlab, but working well since several 
% releases
jButton = javacomponent(javax.swing.JButton(&#039;Ok&#039;), [20,6,100,24], gcf);
jjButton2 = javax.swing.JButton(&#039;Cancel&#039;);
jButton2 = javacomponent(jjButton2,                 [150,6,100,24], gcf);

% Callback events on the Java components can be handled through
% standard matlab function. The push action here are attached to 
% two functions.
hButton = handle(jButton, &#039;CallbackProperties&#039;);
set(jButton, &#039;ActionPerformedCallback&#039;, @CancelCallback);
hButton2 = handle(jButton2, &#039;CallbackProperties&#039;);
set(jButton2, &#039;ActionPerformedCallback&#039;, @OkCallback);

% Uwait waits for the the window to exit and determines is the user
% committed some editor changes or not. In the first case the Java
% string is copied to a matlab string.
uiwait(fa);

if length(jjButton2.getText()) == 0
    r = s; % Take Original
    ok = 0;
else    
    r = char(codeEditor.getText());
    ok = 1;
end

%close fa;

% Matlab callback function
function CancelCallback(hObject, hEventData)
    close(gcf); %exits uwait
end


function OkCallback(hObject, hEventData)
    set(hObject,&#039;Text&#039;,&#039;&#039;);
    close(gcf); % exits uwait
end

% If window is resizable this function resizes also the relevant
% editing box inside. This is not automatically operated by matlab
% when using java swing components.
function myResize(hObject, hEventData, EditContainer)
    sz=get(hObject,&#039;Position&#039;);
    set(EditContainer, &#039;Position&#039;,[20 40 (sz(3)-40) (sz(4)-50)]);
end

end
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>Hi Yair,</p>
<p>Many thanks for your (un)documented work and book.</p>
<p>Here  is my question:</p>
<p>[SHORT]<br />
Is there an easy way to emulate the in &#8216;block&#8217; C code editing<br />
that is available in the &#8220;Embedded Matlab Function&#8221; (SimulinkBlock).</p>
<p>[MORE Detailed]<br />
I was using the old <code>JSyntaxPane</code> Java library, to call for inline editing of hidden block userdata field, and to replace the ugly Usercode blocks managed by the &#8220;ccextopenfcn&#8221;.</p>
<p>However, <code>JSyntexPane</code> Lib is now a bit obsoleted and not more maintained. Therefore I was intended to replace it with more efficient and portable <code>EmbeddedMatlabEditor</code>, thus minimizing also external java dependencies.</p>
<p>Using the post guidance it is easy to open the Docs and flush some actions, but I did not found clear methods to switch syntax parsing to &#8220;C&#8221; and  to intercept the file saving actions (even if a save interceptor method exist in the <code>com.mathworks.mde.editor.MatlabEditorApplication</code>)</p>
<p>Thank you again for your work.</p>
<p>[EVEN MORE]<br />
Here is an example how I integrated the JSyntax</p>
<pre lang="matlab">
function [r,ok] = coloreditjava(s, Title)
import javax.swing.*

% First we create a new Figure with some properties for better look
fa = figure('NumberTitle','off','Name',['SF: ' Title],'DockControls','on',...
'Toolbar','none','Menubar','none');
sz=get(fa,'OuterPosition');
set(fa,'OuterPosition',[sz(1)-340 sz(2)-300 680 730]);
 
% JSYNTAX pane is an external JAR library which handles a color
% editing textbox. The box is similar in functionalities to 
% scintilla, but the use of java here makes the tool portable
% among different platforms (OSX/WIN7 tested)
jsyntaxpane.DefaultSyntaxKit.initKit();
codeEditor = JEditorPane();
% We used the default language as JAVA since is similar to 
% C and the 'C' color editing is not mature enough in the
% external toolbox
codeEditor.setContentType('text/java');
%codeEditor.read(java.io.StringReader(s), 'text/java');

% Secondly we attach and resize this widget to our figure
% we reserve 25 points edge alonside
srcPane = JScrollPane(codeEditor);
[jEdit,EditContainer] = javacomponent(srcPane, [20,40,640,700], fa);
set(fa, 'ResizeFcn',{@myResize, EditContainer});
codeEditor.setEditorKit(jsyntaxpane.syntaxkits.JavaSyntaxKit());
codeEditor.setText(char(s));        

% on the bottom we attached two Java buttons which are defined on the
% fly. Any java swing component may be used here. This is not
% officially supported matlab, but working well since several 
% releases
jButton = javacomponent(javax.swing.JButton('Ok'), [20,6,100,24], gcf);
jjButton2 = javax.swing.JButton('Cancel');
jButton2 = javacomponent(jjButton2,                 [150,6,100,24], gcf);

% Callback events on the Java components can be handled through
% standard matlab function. The push action here are attached to 
% two functions.
hButton = handle(jButton, 'CallbackProperties');
set(jButton, 'ActionPerformedCallback', @CancelCallback);
hButton2 = handle(jButton2, 'CallbackProperties');
set(jButton2, 'ActionPerformedCallback', @OkCallback);

% Uwait waits for the the window to exit and determines is the user
% committed some editor changes or not. In the first case the Java
% string is copied to a matlab string.
uiwait(fa);

if length(jjButton2.getText()) == 0
    r = s; % Take Original
    ok = 0;
else    
    r = char(codeEditor.getText());
    ok = 1;
end

%close fa;

% Matlab callback function
function CancelCallback(hObject, hEventData)
    close(gcf); %exits uwait
end


function OkCallback(hObject, hEventData)
    set(hObject,'Text','');
    close(gcf); % exits uwait
end

% If window is resizable this function resizes also the relevant
% editing box inside. This is not automatically operated by matlab
% when using java swing components.
function myResize(hObject, hEventData, EditContainer)
    sz=get(hObject,'Position');
    set(EditContainer, 'Position',[20 40 (sz(3)-40) (sz(4)-50)]);
end

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