<?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: setPrompt &#8211; Setting the Matlab Desktop prompt</title> <atom:link href="http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/feed/" rel="self" type="application/rss+xml" /><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/</link> <description>Charting Matlab's unsupported hidden underbelly</description> <lastBuildDate>Thu, 09 Feb 2012 09:23:08 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.1</generator> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-11434</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Wed, 23 Jun 2010 16:18:39 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-11434</guid> <description>@Rudolph - thanks.
Re the console, I don&#039;t know. You&#039;re welcome to try and possibly modify the source code. If you find anything useful, please send me</description> <content:encoded><![CDATA[<p>@Rudolph &#8211; thanks.<br
/> Re the console, I don&#8217;t know. You&#8217;re welcome to try and possibly modify the source code. If you find anything useful, please send me</p> ]]></content:encoded> </item> <item><title>By: Rudolph</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-11430</link> <dc:creator>Rudolph</dc:creator> <pubDate>Wed, 23 Jun 2010 15:18:11 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-11430</guid> <description>I&#039;ve been looking for a decent prompt control/replacement for a *very* long time! This is fantastic!I do have one question/request. Mostly I run MatLAB in a term (gnome-terminal/konsole/whatever) and not from the MatLAB GUI (matlab -nosplahs -nodesktop).Would your approach work for modifying the prompt in a console? Maybe something like setPromptCon..?</description> <content:encoded><![CDATA[<p>I&#8217;ve been looking for a decent prompt control/replacement for a *very* long time! This is fantastic!</p><p>I do have one question/request. Mostly I run MatLAB in a term (gnome-terminal/konsole/whatever) and not from the MatLAB GUI (matlab -nosplahs -nodesktop).</p><p>Would your approach work for modifying the prompt in a console? Maybe something like setPromptCon..?</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-8663</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Wed, 31 Mar 2010 15:21:04 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-8663</guid> <description>@junziyang - yes: you can add the &lt;b&gt;&lt;i&gt;setPrompt&lt;/i&gt;&lt;/b&gt; command to your startup.m function and it will be used in each Matlab session automatically.If you don&#039;t have a startup.m file, simply create one in your Matlab startup folder - it&#039;s a simple Matlab script file that contains commands that run automatically whenever Matlab starts in that folder.</description> <content:encoded><![CDATA[<p>@junziyang &#8211; yes: you can add the <b><i>setPrompt</i></b> command to your startup.m function and it will be used in each Matlab session automatically.</p><p>If you don&#8217;t have a startup.m file, simply create one in your Matlab startup folder &#8211; it&#8217;s a simple Matlab script file that contains commands that run automatically whenever Matlab starts in that folder.</p> ]]></content:encoded> </item> <item><title>By: junziyang</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-8651</link> <dc:creator>junziyang</dc:creator> <pubDate>Wed, 31 Mar 2010 06:10:09 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-8651</guid> <description>Another GREAT work!
Can this function be improved to make the user difined prompt as the default one  instead of calling setPrompt to manually set on each MATLAB session?</description> <content:encoded><![CDATA[<p>Another GREAT work!<br
/> Can this function be improved to make the user difined prompt as the default one  instead of calling setPrompt to manually set on each MATLAB session?</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-6687</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Tue, 02 Feb 2010 07:16:17 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-6687</guid> <description>@Bassam - you can use a similar approach to &lt;b&gt;&lt;i&gt;setPrompt&lt;/i&gt;&lt;/b&gt; (you can use &lt;b&gt;&lt;i&gt;setPrompt&lt;/i&gt;&lt;/b&gt;&#039;s source code as the baseline) - set the command-window&#039;s &lt;b&gt;CaretUpdateCallback&lt;/b&gt; to send the new text to the remote PC and then store the existing text in a persistent variable. Your callback function will look something like this:&lt;pre lang=&quot;matlab&quot;&gt;
function setPromptFcn(jTextArea,eventData)% Callback reentry-prevention
persistent inProgress
if isempty(inProgress)
inProgress = 1;  %#ok unused
else
return;
end% Preserve the last-processed text position
persistent previousPos
if isempty previousPos,  previousPos=0;  end% Process new text
cwText = get(jTextArea,&#039;Text&#039;);% Handle clear-window actions
if length(cwText) &lt; previousPos
previousPos=0;
end% Send the new text to the remote PC
sendRemote(cwText(previousPos+1:end));
previousPos = length(cwText);% Re-enable additional callback events
inProgress = [];
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>@Bassam &#8211; you can use a similar approach to <b><i>setPrompt</i></b> (you can use <b><i>setPrompt</i></b>&#8216;s source code as the baseline) &#8211; set the command-window&#8217;s <b>CaretUpdateCallback</b> to send the new text to the remote PC and then store the existing text in a persistent variable. Your callback function will look something like this:</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">function</span> setPromptFcn<span style="color: #080;">&#40;</span>jTextArea,eventData<span style="color: #080;">&#41;</span>
&nbsp;
  <span style="color: #228B22;">% Callback reentry-prevention</span>
  <span style="color: #0000FF;">persistent</span> inProgress
  <span style="color: #0000FF;">if</span> <span style="color: #0000FF;">isempty</span><span style="color: #080;">&#40;</span>inProgress<span style="color: #080;">&#41;</span>
    inProgress = <span style="color: #33f;">1</span>;  <span style="color: #228B22;">%#ok unused</span>
  <span style="color: #0000FF;">else</span>
    <span style="color: #0000FF;">return</span>;
  <span style="color: #0000FF;">end</span>
&nbsp;
  <span style="color: #228B22;">% Preserve the last-processed text position</span>
  <span style="color: #0000FF;">persistent</span> previousPos
  <span style="color: #0000FF;">if</span> <span style="color: #0000FF;">isempty</span> previousPos,  previousPos=<span style="color: #33f;">0</span>;  <span style="color: #0000FF;">end</span>
&nbsp;
  <span style="color: #228B22;">% Process new text</span>
  cwText = <span style="color: #0000FF;">get</span><span style="color: #080;">&#40;</span>jTextArea,<span style="color:#A020F0;">'Text'</span><span style="color: #080;">&#41;</span>;
&nbsp;
  <span style="color: #228B22;">% Handle clear-window actions</span>
  <span style="color: #0000FF;">if</span> <span style="color: #0000FF;">length</span><span style="color: #080;">&#40;</span>cwText<span style="color: #080;">&#41;</span> &lt; previousPos
    previousPos=<span style="color: #33f;">0</span>;
  <span style="color: #0000FF;">end</span>
&nbsp;
  <span style="color: #228B22;">% Send the new text to the remote PC</span>
  sendRemote<span style="color: #080;">&#40;</span>cwText<span style="color: #080;">&#40;</span>previousPos+<span style="color: #33f;">1</span><span style="color: #F0F;">:</span><span style="color: #0000FF;">end</span><span style="color: #080;">&#41;</span><span style="color: #080;">&#41;</span>;
  previousPos = <span style="color: #0000FF;">length</span><span style="color: #080;">&#40;</span>cwText<span style="color: #080;">&#41;</span>;
&nbsp;
  <span style="color: #228B22;">% Re-enable additional callback events</span>
  inProgress = <span style="color: #080;">&#91;</span><span style="color: #080;">&#93;</span>;</pre></div></div>]]></content:encoded> </item> <item><title>By: Bass</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-6679</link> <dc:creator>Bass</dc:creator> <pubDate>Tue, 02 Feb 2010 03:27:07 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-6679</guid> <description>Hey Yair, Great article on setPromptI would like to catch everything that will be printed in the command window and be able to send it to a remote PC via udp.Can you suggest what callbacks/ approach may be useful in doing this?thanks!</description> <content:encoded><![CDATA[<p>Hey Yair, Great article on setPrompt</p><p>I would like to catch everything that will be printed in the command window and be able to send it to a remote PC via udp.</p><p>Can you suggest what callbacks/ approach may be useful in doing this?</p><p>thanks!</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-6488</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Tue, 26 Jan 2010 23:20:43 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-6488</guid> <description>Update: I have received a report that &lt;b&gt;&lt;i&gt;setPrompt&lt;/i&gt;&lt;/b&gt; fouls up the Command Window (CW) on Mac platforms. Since the utility&#039;s code and the CW is Java-based, I have a feeling that the problems are due to bugs in the Java used on MacOS (there are numerous other problems with Java on Mac that affect Matlab). I can&#039;t test this since I have no Mac.Oh well - I guess we&#039;re left with using &lt;b&gt;&lt;i&gt;setPrompt&lt;/i&gt;&lt;/b&gt; on non-Mac platforms.I would love to hear specific details about similar compatibility issues.</description> <content:encoded><![CDATA[<p>Update: I have received a report that <b><i>setPrompt</i></b> fouls up the Command Window (CW) on Mac platforms. Since the utility&#8217;s code and the CW is Java-based, I have a feeling that the problems are due to bugs in the Java used on MacOS (there are numerous other problems with Java on Mac that affect Matlab). I can&#8217;t test this since I have no Mac.</p><p>Oh well &#8211; I guess we&#8217;re left with using <b><i>setPrompt</i></b> on non-Mac platforms.</p><p>I would love to hear specific details about similar compatibility issues.</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-6471</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Tue, 26 Jan 2010 08:55:08 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-6471</guid> <description>Hi Mike - Since the original post I have discovered two minor edge cases - when clearing the window (&lt;b&gt;&lt;i&gt;clc&lt;/i&gt;&lt;/b&gt;) and when invoking other windows (e.g., &lt;b&gt;&lt;i&gt;edit&lt;/i&gt;&lt;/b&gt;). These issues have since been fixed in the posted code as well as on FEX (should be available later today I guess).The only unsolved issue I have seen is that when selecting desktop text and pasting to the Editor, the prompt is not stripped as it is with the default prompt.Otherwise, the new prompt appears to work exactly as expected, with copy/paste, selection/F9, tab completion, help popups, history/editing etc. The Editor-Desktop interaction also works exactly as expected (aside from the known issue above).I haven&#039;t tested thoroughly on non-Windows platforms and/or multiple Matlab releases, but I expect the changes to be minor at worst.Regarding assumptions, there are two inherent: that the default prompt ends with &#039;&gt;&gt; &#039; and that the desktop TextArea can be accessed as described (this depends on the undocumented internal hierarchy, which may change between releases). For the moment these assumptions seem valid. </description> <content:encoded><![CDATA[<p>Hi Mike &#8211; Since the original post I have discovered two minor edge cases &#8211; when clearing the window (<b><i>clc</i></b>) and when invoking other windows (e.g., <b><i>edit</i></b>). These issues have since been fixed in the posted code as well as on FEX (should be available later today I guess).</p><p>The only unsolved issue I have seen is that when selecting desktop text and pasting to the Editor, the prompt is not stripped as it is with the default prompt.</p><p>Otherwise, the new prompt appears to work exactly as expected, with copy/paste, selection/F9, tab completion, help popups, history/editing etc. The Editor-Desktop interaction also works exactly as expected (aside from the known issue above).</p><p>I haven&#8217;t tested thoroughly on non-Windows platforms and/or multiple Matlab releases, but I expect the changes to be minor at worst.</p><p>Regarding assumptions, there are two inherent: that the default prompt ends with &#8216;>> &#8216; and that the desktop TextArea can be accessed as described (this depends on the undocumented internal hierarchy, which may change between releases). For the moment these assumptions seem valid.</p> ]]></content:encoded> </item> <item><title>By: Mike</title><link>http://undocumentedmatlab.com/blog/setprompt-setting-matlab-desktop-prompt/#comment-6466</link> <dc:creator>Mike</dc:creator> <pubDate>Tue, 26 Jan 2010 02:18:29 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=965#comment-6466</guid> <description>Very Interesting. Have you found any issues with operations that make assumptions about the prompt, such as tab completion, or copying/pasting to the Editor?</description> <content:encoded><![CDATA[<p>Very Interesting. Have you found any issues with operations that make assumptions about the prompt, such as tab completion, or copying/pasting to the Editor?</p> ]]></content:encoded> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk: basic
Theme:              b7666
Template:           single
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: undocumentedmatlab.com @ 2012-02-09 06:06:49 -->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          blog/setprompt-setting-matlab-desktop-prompt/feed/_index.xml_gzip
Caching:            enabled
Status:             not cached
Creation Time:      0.650s
Header info:
X-Pingback:         http://undocumentedmatlab.com/blog/xmlrpc.php
Set-Cookie:         wpgb_visit_last_php-default=1328792809; expires=Fri, 08-Feb-2013 13:06:49 GMT; path=/
Link:               <http://undocumentedmatlab.com/?p=965>; rel=shortlink
Content-Type:       text/xml; charset=UTF-8
Last-Modified:      Thu, 09 Feb 2012 13:06:49 GMT
Vary:               Accept-Encoding, Cookie
Expires:            Thu, 09 Feb 2012 14:06:49 GMT
Pragma:             public
Cache-Control:      public, must-revalidate, proxy-revalidate
Etag:               56ed2e0cb0d6e2a52ef9dd3e95b4efa3
Content-Encoding:   gzip
-->
