<?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>Bug &#8211; Undocumented Matlab</title>
	<atom:link href="https://undocumentedmatlab.com/articles/tag/bug/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Thu, 05 Jan 2017 17:15:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.3</generator>
	<item>
		<title>Quirks with parfor vs. for</title>
		<link>https://undocumentedmatlab.com/articles/quirks-with-parfor-vs-for?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quirks-with-parfor-vs-for</link>
					<comments>https://undocumentedmatlab.com/articles/quirks-with-parfor-vs-for#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Thu, 05 Jan 2017 17:15:48 +0000</pubDate>
				<category><![CDATA[Guest bloggers]]></category>
		<category><![CDATA[Medium risk of breaking in future versions]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[Stock Matlab function]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Pure Matlab]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=6821</guid>

					<description><![CDATA[<p>Parallelizing loops with Matlab's parfor might generate unexpected results. Users beware! </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/quirks-with-parfor-vs-for">Quirks with parfor vs. for</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/a-few-parfor-tips" rel="bookmark" title="A few parfor tips">A few parfor tips </a> <small>The parfor (parallel for) loops can be made faster using a few simple tips. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/matlab-compilation-quirks-take-2" rel="bookmark" title="Matlab compilation quirks &#8211; take 2">Matlab compilation quirks &#8211; take 2 </a> <small>A few hard-to-trace quirks with Matlab compiler outputs are explained. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/quirks-with-compiled-matlab-dlls" rel="bookmark" title="Quirks with compiled Matlab DLLs">Quirks with compiled Matlab DLLs </a> <small>Several quirks with Matlab-compiled DLLs are discussed and workarounds suggested. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/preallocation-performance" rel="bookmark" title="Preallocation performance">Preallocation performance </a> <small>Preallocation is a standard Matlab speedup technique. Still, it has several undocumented aspects. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>A few months ago, I discussed several <a href="/articles/a-few-parfor-tips" target="_blank">tips regarding Matlab&#8217;s <i><b>parfor</b></i></a> command, which is used by the Parallel Computing Toolbox (PCT) for parallelizing loops. Today I wish to extend that post with some unexplained oddities when using <i><b>parfor</b></i></a>, compared to a standard <i><b>for</b></i> loop.</p>
<h3 id="serialization">Data serialization quirks</h3>
<p><a href="http://www.mathworks.com/matlabcentral/profile/authors/870050-dimitri-shvorob" rel="nofollow" target="_blank">Dimitri Shvorob</a> may not appear at first glance to be a prolific contributor on Matlab Central, but from the little he has posted over the years I regard him to be a Matlab power-user. So when Dimitri reports something, I take it seriously. Such was the case several months ago, when he contacted me regarding very odd behavior that he saw in his code: the <i><b>for</b></i> loop worked well, but the <i><b>parfor</b></i> version returned different (incorrect) results. Eventually, Dimitry traced the problem to something <a href="http://fluffynukeit.com/tag/loadobj" rel="nofollow" target="_blank">originally reported</a> by Dan Austin on his <a href="http://fluffynukeit.com" rel="nofollow" target="_blank">Fluffy Nuke It blog</a>.<br />
The core issue is that if we have a class object that is used within a <i><b>for</b></i> loop, Matlab can access the object directly in memory. But with a <i><b>parfor</b></i> loop, the object needs to be serialized in order to be sent over to the parallel workers, and deserialized within each worker. If this serialization/deserialization process involves internal class methods, the workers might see a different version of the class object than the one seen in the serial <i><b>for</b></i> loop. This could happen, for example, if the serialization/deserialization method croaks on an error, or depends on some dynamic (or random) conditions to create data.<br />
In other words, when we use data objects in a <i><b>parfor</b></i> loop, the data object is not necessarily sent &#8220;as-is&#8221;: additional processing may be involved under the hood that modify the data in a way that may be invisible to the user (or the loop code), resulting in different processing results of the parallel (<i><b>parfor</b></i>) vs. serial (<i><b>for</b></i>) loops.<br />
For additional aspects of Matlab serialization/deserialization, see <a href="/articles/serializing-deserializing-matlab-data" target="_blank">my article</a> from 2 years ago (and its interesting feedback comments).</p>
<h3 id="precision">Data precision quirks</h3>
<p><i>The following section was contributed by guest blogger Lior Perlmuter-Shoshany, head algorithmician at a private equity fund.</i><br />
In my work, I had to work with matrixes in the order of 10<sup>9</sup> cells. To reduce the memory footprint (and hopefully also improve performance), I decided to work with data of type <code>single</code> instead of Matlab&#8217;s default <code>double</code>. Furthermore, in order to speed up the calculation I use <i><b>parfor</b></i> rather than <i><b>for</b></i> in the main calculation. In the end of the run I am running a mini <i><b>for</b></i>-loop to see the best results.<br />
What I discovered to my surprise is that the results from the <b><i>parfor</i></b> and <i><b>for</b></i> loop variants is not the same!<br />
<span id="more-6821"></span><br />
The following simplified code snippet illustrate the problem by calculating a simple standard-deviation (<i><b>std</b></i>) over the same data, in both <code>single</code>&#8211; and <code>double</code>-precision. Note that the loops are ran with only a single iteration, to illustrate the fact that the problem is with the parallelization mechanism (probably the serialization/deserialization parts once again), not with the distribution of iterations among the workers.</p>
<pre lang="matlab">
clear
rng('shuffle','twister');
% Prepare the data in both double and single precision
arr_double = rand(1,100000000);
arr_single = single(arr_double);
% No loop - direct computation
std_single0 = std(arr_single);
std_double0 = std(arr_double);
% Loop #1 - serial for loop
std_single = 0;
std_double = 0;
for i=1
    std_single(i) = std(arr_single);
    std_double(i) = std(arr_double);
end
% Loop #2 - parallel parfor loop
par_std_single = 0;
par_std_double = 0;
parfor i=1
    par_std_single(i) = std(arr_single);
    par_std_double(i) = std(arr_double);
end
% Compare results of for loop vs. non-looped computation
isForSingleOk = isequal(std_single, std_single0)
isForDoubleOk = isequal(std_double, std_double0)
% Compare results of single-precision data (for vs. parfor)
isParforSingleOk = isequal(std_single, par_std_single)
parforSingleAccuracy = std_single / par_std_single
% Compare results of double-precision data (for vs. parfor)
isParforDoubleOk = isequal(std_double, par_std_double)
parforDoubleAccuracy = std_double / par_std_double
</pre>
<p>Output example :</p>
<pre lang="matlab">
isForSingleOk =
    1                   % <= true (of course!)
isForDoubleOk =
    1                   % <= true (of course!)
isParforSingleOk =
    0                   % <= false (odd!)
parforSingleAccuracy =
    0.73895227413361    % <= single-precision results are radically different in parfor vs. for
isParforDoubleOk =
    0                   % <= false (odd!)
parforDoubleAccuracy =
    1.00000000000021    % <= double-precision results are almost [but not exactly] the same in parfor vs. for
</pre>
<p>From my testing, the larger the data array, the bigger the difference is between the results of <code>single</code>-precision data when running in <i><b>for</b></i> vs. <i><b>parfor</b></i>.<br />
In other words, my experience has been that if you have a huge data matrix, it's better to parallelize it in <code>double</code>-precision if you wish to get [nearly] accurate results. But even so, I find it deeply disconcerting that the results are not exactly identical (at least on R2015a-R2016b on which I tested) even for the native <code>double</code>-precision .<br />
Hmmm... bug?</p>
<h3 id="travels">Upcoming travels - Zürich & Geneva</h3>
<p>I will shortly be traveling to clients in Zürich and Geneva, Switzerland. If you are in the area and wish to meet me to discuss how I could bring value to your work with some advanced Matlab consulting or training, then please email me (altmany at gmail):</p>
<ul>
<li><b>Zürich</b>: January 15-17</li>
<li><b>Geneva</b>: January 18-21</li>
</ul>
<p>Happy new year everybody!</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/quirks-with-parfor-vs-for">Quirks with parfor vs. for</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/a-few-parfor-tips" rel="bookmark" title="A few parfor tips">A few parfor tips </a> <small>The parfor (parallel for) loops can be made faster using a few simple tips. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/matlab-compilation-quirks-take-2" rel="bookmark" title="Matlab compilation quirks &#8211; take 2">Matlab compilation quirks &#8211; take 2 </a> <small>A few hard-to-trace quirks with Matlab compiler outputs are explained. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/quirks-with-compiled-matlab-dlls" rel="bookmark" title="Quirks with compiled Matlab DLLs">Quirks with compiled Matlab DLLs </a> <small>Several quirks with Matlab-compiled DLLs are discussed and workarounds suggested. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/preallocation-performance" rel="bookmark" title="Preallocation performance">Preallocation performance </a> <small>Preallocation is a standard Matlab speedup technique. Still, it has several undocumented aspects. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/quirks-with-parfor-vs-for/feed</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Matlab compiler bug and workaround</title>
		<link>https://undocumentedmatlab.com/articles/matlab-compiler-bug-and-workaround?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=matlab-compiler-bug-and-workaround</link>
					<comments>https://undocumentedmatlab.com/articles/matlab-compiler-bug-and-workaround#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 28 Jan 2015 18:00:02 +0000</pubDate>
				<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[Stock Matlab function]]></category>
		<category><![CDATA[Toolbox]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Pure Matlab]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5529</guid>

					<description><![CDATA[<p>Both the Matlab compiler and the publish function have errors when parsing block-comments in Matlab m-code. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/matlab-compiler-bug-and-workaround">Matlab compiler bug and workaround</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/bug-and-workaround-in-timeseries-plot" rel="bookmark" title="Bug and workaround in timeseries plot">Bug and workaround in timeseries plot </a> <small>Matlab's internal hgconvertunits function has a bug that affects timeseries plots. Luckily there is a simple workaround....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/spicing-up-matlab-uicontrol-tooltips" rel="bookmark" title="Spicing up Matlab uicontrol tooltips">Spicing up Matlab uicontrol tooltips </a> <small>Matlab uicontrol tooltips can be spiced-up using HTML and CSS, including fonts, colors, tables and images...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/types-of-undocumented-matlab-aspects" rel="bookmark" title="Types of undocumented Matlab aspects">Types of undocumented Matlab aspects </a> <small>This article lists the different types of undocumented/unsupported/hidden aspects in Matlab...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/matlab-compilation-quirks-take-2" rel="bookmark" title="Matlab compilation quirks &#8211; take 2">Matlab compilation quirks &#8211; take 2 </a> <small>A few hard-to-trace quirks with Matlab compiler outputs are explained. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>I recently consulted at a client who uses R2010a and compiles his code for distribution. Debugging compiled code is often tricky, since we do not have the Matlab desktop to help us debug stuff (well, actually we do have access to a scaled-down desktop for minimal debugging using some undocumented internal hooks, but that&#8217;s a topic for a separate article). In my client&#8217;s case, I needed to debug a run-time error that threw an exception to the console:</p>
<div class="wp_syntax">
<div class="code">
<pre class="c" style="font-family:monospace;"><span style="color: red;">Error using strtrim
Input should be a string or a cell array of strings.
Error in updateGUI (line 121)</span></pre>
</div>
</div>
<p>Sounds simple enough to debug right? Just go to <i>updateGUI.m</i> line #121 and fix the call to <i><b>strtrim</b>()</i>, correct?<br />
Well, not so fast&#8230; It turns out that updateGUI.m line #121 is an empty line surrounded on either side by one-line comments. This is certainly not the line that caused the error. The actual call to <i><b>strtrim</b>()</i> only occurs in line #147!<br />
What&#8217;s going on?<br />
The answer is that the Matlab compiler has a bug with comment blocks &#8211; lines surrounded by <code>%{</code> and <code>%}</code>:</p>
<div class="wp_syntax">
<div class="code">
<pre class="matlab" style="font-family:monospace;">15   <span style="color: #228B22;">%{</span>
16       <span style="color: #228B22;">This is a comment block that is</span>
17       <span style="color: #228B22;">ignored by the Matlab engine,</span>
18       <span style="color: #228B22;">and causes a line-numbering</span>
19       <span style="color: #228B22;">error in the Matlab compiler!</span>
20   <span style="color: #228B22;">%}</span>
21&nbsp;
22   a = strtrim<span style="color: #080;">(</span><span style="color: #0000FF;">3.1416</span><span style="color: #080;">)</span>;  <span style="color: #228B22;">% this generates an error</span></pre>
</div>
</div>
<p>In the example above, the 6-line comment block is ignored as expected by the Matlab engine in both interactive and compiled modes. However, whereas in interactive mode the error is correctly reported for line #22, in compiled mode it is reported for line #17. Apparently the compiler replaces any block comment with a single comment line before parsing the m-file.<br />
<span id="more-5529"></span><br />
The workaround is simple: count all the block-comment lines that precede the reported error line in the original m-file, and add that number to the reported line. In the example above, 17 + (6-1) = 22. Note that the source code could have multiple block-comments that precede the reported line, and they should all be counted. Here is a basic code snippet that does this parsing and opens the relevant m-file at the correct location:</p>
<pre lang='matlab'>
% Read the source file (*.m)
str = fileread(filename,'*char');
% Split the contents into separate lines
lines = strtrim(strsplit(str',10));
% Search for comment block tokens
start_idx = find(strcmp(lines,'%{'));
end_idx   = find(strcmp(lines,'%}'));
% Count the number of block-comment lines in the source code
delta_idx = end_idx - start_idx;
relevant_idx = sum(start_idx < reported_line_number);
total_comment_block_lines = sum(delta_idx(1:relevant_idx));
% Open the source file at the correct line
opentoline(filename, reported_line_number + total_comment_block_lines);
</pre>
<p>This code snippet can fairly easily be wrapped in a stand-alone utility by anyone who wishes to do so. You'd need to generate the proper full-path source-code (m-file) filename of course, since this is not reported by the deployed application in its error message. You'd also need to take care of edge-cases such as p-coded or mex files, or missing source-code m-files. You'd also need to parse the input parameters (presumably filename and reported_line_number, but possibly also other inputs).<br />
This is another example of a bug that does not officially exist in Matlab's public <a target="_blank" rel="nofollow" href="https://www.mathworks.com/support/bugreports">bug parade</a> (at least, I couldn't find it). I've reported other such undocumented bugs in previous articles (<a target="_blank" href="/articles/couple-of-matlab-bugs-and-workarounds">here</a> and <a target="_blank" href="/articles/couple-of-bugs-and-workarounds">here</a>). Please don't start another comments tirade on MathWorks' bug-publication policies. I think that issue has already been discussed ad nauseam.<br />
<b><u>Update</u></b>: according to <a target="_blank" href="/articles/matlab-compiler-bug-and-workaround#comment-345140">Tom's comment</a> below, this bug was apparently fixed in R2012b.<br />
Another related bug related to block comments is that at least on some Matlab releases (I haven't tested properly to determine which releases), block comments are NOT properly ignored by the Editor's <i><b>publish</b></i> functionality. Instead, at least on those releases where the bug occurs, publishing code that includes block comments parses the block's contents as if it was runnable code. In other words, <i><b>publish</b></i> treats <code>%{</code> and <code>%}</code> as one-line comments rather than as tokens marking the ends of a block comment.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/matlab-compiler-bug-and-workaround">Matlab compiler bug and workaround</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/bug-and-workaround-in-timeseries-plot" rel="bookmark" title="Bug and workaround in timeseries plot">Bug and workaround in timeseries plot </a> <small>Matlab's internal hgconvertunits function has a bug that affects timeseries plots. Luckily there is a simple workaround....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/spicing-up-matlab-uicontrol-tooltips" rel="bookmark" title="Spicing up Matlab uicontrol tooltips">Spicing up Matlab uicontrol tooltips </a> <small>Matlab uicontrol tooltips can be spiced-up using HTML and CSS, including fonts, colors, tables and images...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/types-of-undocumented-matlab-aspects" rel="bookmark" title="Types of undocumented Matlab aspects">Types of undocumented Matlab aspects </a> <small>This article lists the different types of undocumented/unsupported/hidden aspects in Matlab...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/matlab-compilation-quirks-take-2" rel="bookmark" title="Matlab compilation quirks &#8211; take 2">Matlab compilation quirks &#8211; take 2 </a> <small>A few hard-to-trace quirks with Matlab compiler outputs are explained. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/matlab-compiler-bug-and-workaround/feed</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Another couple of Matlab bugs and workarounds</title>
		<link>https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=couple-of-matlab-bugs-and-workarounds</link>
					<comments>https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 26 Nov 2014 18:00:27 +0000</pubDate>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Figure window]]></category>
		<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[Stock Matlab function]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Figure]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5272</guid>

					<description><![CDATA[<p>A couple of internal Matlab bugs and their workarounds. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds">Another couple of Matlab bugs and workarounds</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds" rel="bookmark" title="A couple of internal Matlab bugs and workarounds">A couple of internal Matlab bugs and workarounds </a> <small>A couple of undocumented Matlab bugs have simple workarounds. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part2" rel="bookmark" title="Explicit multi-threading in Matlab part 2">Explicit multi-threading in Matlab part 2 </a> <small>Matlab performance can be improved by employing .Net (C#, VB, F# or C++) threads. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3" rel="bookmark" title="Explicit multi-threading in Matlab part 3">Explicit multi-threading in Matlab part 3 </a> <small>Matlab performance can be improved by employing POSIX threads in C/C++ code. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/the-hotlinks-feature" rel="bookmark" title="The HotLinks feature">The HotLinks feature </a> <small>feature('HotLinks') can be used to temporarily disable hyperlinks and other markups in the Matlab console. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>Every now and then I come across some internal Matlab bugs. In many cases I find a workaround and move on, sometimes bothering to report the bugs to <a target="_blank" rel="nofollow" href="mailto:support@mathworks.com">MathWorks support</a>, but often not. In truth, it&#8217;s a bit frustrating to hear the standard response that the issue [or &#8220;unexpected behavior&#8221;, but never &#8220;bug&#8221; &#8211; apparently that&#8217;s a taboo word] <i>&#8220;has been reported to the development team and they will consider fixing it in one of the future releases of MATLAB&#8221;</i>.<br />
To date I&#8217;ve reported dozens of bugs and as far as I can tell, few if any of them have actually been fixed, years after I&#8217;ve reported them. None of them appear on Matlab&#8217;s <a target="_blank" rel="nofollow" href="https://www.mathworks.com/support/bugreports/">official bug parade</a>, which is only a small subset of the full list that MathWorks keeps hidden for some unknown reason (<i>update: see the discussion in the comments thread below, especially the input by <a href="/articles/couple-of-matlab-bugs-and-workarounds#comment-340799">Steve Eddins</a></i>). Never mind, I don&#8217;t take it personally, I simply find a workaround and move on. I&#8217;ve already <a target="_blank" href="/articles/couple-of-bugs-and-workarounds">posted about this</a> before. Today I&#8217;ll discuss two additional bugs I&#8217;ve run across once-too-often, and my workarounds:</p>
<ul>
<li><a href="/articles/couple-of-matlab-bugs-and-workarounds#diary">Saving non-Latin Command Window text using <i><b>diary</b></i></a></li>
<li><a href="/articles/couple-of-matlab-bugs-and-workarounds#print">Printing GUIs reliably</a></li>
</ul>
<p>Nothing really earth-shattering, but annoying nonetheless.<br />
<span id="more-5272"></span></p>
<h3 id="diary">Saving non-Latin Command Window text using <i><b>diary</b></i></h3>
<p>The <a target="_blank" rel="nofollow" href="http://www.mathworks.com/help/matlab/ref/diary.html"><i><b>diary</b></i></a> function is well-known for saving Matlab&#8217;s Command-Window (CW) text to a file. The function has existed for the past two decades at least, possibly even longer.<br />
Unfortunately, perhaps the developer never thought that Matlab would be used outside the Americas and Western Europe, otherwise I cannot understand why to this day <i><b>diary</b></i> saves the text in ASCII format rather than the <a target="_blank" rel="nofollow" href="http://en.wikipedia.org/wiki/UTF-16">UTF-16</a> variant used by the CW. This works ok for basic Latin characters, but anyone who outputs Chinese, Japanese, Korean, Hindi, Arabic, Hebrew or other alphabets to the CW, and tries to save it using <i><b>diary</b></i>, will find the file unreadable.<br />
Here is a sample illustrative script, that outputs the Arabic word <i>salaam</i> (peace, &#1587;&#1604;&#1575;&#1605;) to the CW and then tries to save this using <i><b>diary</b></i>. If you try it, you will see it ok in the CW, but garbage text in the generated text file:</p>
<pre lang='matlab'>
>> fname='diary_bug.txt'; diary(fname); disp(char([1587,1604,1575,1605])); diary off; winopen(fname)
سلام
</pre>
<p>The problem is that since <i><b>diary</b></i> assumes ASCII characters, any characters having a numeric value above 255 get truncated and are stored as invalid 1-byte characters, char(26) in this case.<br />
Here&#8217;s my workaround:</p>
<pre lang='matlab'>
% Output Command Window text to a text file
function saveCmdWinText(filename)
    cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;
    txt = char(cmdWinDoc.getText(0,cmdWinDoc.getLength));
    fid = fopen(filename,'W');
    fwrite(fid,txt,'uint16');  % store as 2-byte characters
    fclose(fid);
    %winopen(filename);  % in case you wish to verify...
end
</pre>
<p>This works well, saving the characters in their original 2-byte format, for those alphabets that use 2-bytes: non-basic Latins, Greek, Cyrillic, Armenian, Arabic, Hebrew, Coptic, Syriac and Tāna (I don&#8217;t think there are more than a handful of Matlab users who use Coptic, Syriac or Tāna but never mind). However, UTF-8 specifies that CJK characters need 3-4 bytes and this is apparently not supported in Matlab, whose basic <i><b>char</b></i> data type only has 2 bytes, so I assume that Chinese, Japanese and Korean will probably require a different solution (perhaps the internal implementation of <i><b>char</b></i> and the CW is different in the Chinese/Japanese versions of Matlab, I really don&#8217;t know. If this is indeed the case, then perhaps a variant of my workaround can also be used for CJK output).</p>
<blockquote><p>
Correction #1: I have learned since posting (see Steve Eddins&#8217; <a href="/articles/couple-of-matlab-bugs-and-workarounds#comment-340803">comment</a> below) that Matlab actually uses UTF-16 rather than UTF-8, solving the CJK issue. I humbly stand corrected.<br />
Correction #2: The <code>saveCmdWinText</code> code above saves the CW text in UTF-16 format. This may be problematic in some text editors that are not UTF-savvy. For such editors (or if your editor get confused with the various BOM/endianness options), consider saving the data in UTF-8 format &#8211; again, assuming you&#8217;re not using an alphabet [such as CJK] outside the ASCII range (thanks Rob):</p>
<pre lang='matlab'>
function saveCmdWinText_UTF8(filename)
    cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;
    txt = char(cmdWinDoc.getText(0,cmdWinDoc.getLength));
    fid = fopen(filename,'W','n','utf-8');
    fwrite(fid,txt,'char');
    fclose(fid);
    %winopen(filename);  % in case you wish to verify...
end
</pre>
</blockquote>
<p>Also, this workaround is problematic in the sense that it&#8217;s a one-time operation that stores the entire CW text that is visible at that point. This is more limited than <i><b>diary</b></i>&#8216;s ability to start and stop output recording in mid-run, and to record output on-the-fly (rather than only at the end). Still, it does provide a solution in case you output non-ASCII 2-byte characters to the CW.</p>
<blockquote><p>Update: I plan to post a utility to the Matlab File Exchange in the near future that will mimic <b>diary</b>&#8216;s ability to start/stop text recording, rather than simply dumping the entire CW contents to file. I&#8217;ll update here when this utility is ready for download.</p></blockquote>
<p>There are various other bugs related to entering non-Latin (and specifically RTL) characters in the CW and the Matlab Editor. Solving the <i><b>diary</b></i> bug is certainly the least of these worries. Life goes on&#8230;<br />
p.s. &#8211; I typically use <a target="_blank" rel="nofollow" href="http://kanjidict.stc.cx/recode.php">this translator</a> to convert from native script to UTF codes that can be used in Matlab. I&#8217;m sure there are plenty of other translators, but this one does the job well enough for me.<br />
For people interested in learning more about the Command Window internals, take a look at my <a target="_blank" href="/articles/cprintf-display-formatted-color-text-in-command-window"><i><b>cprintf</b></i></a> and <a target="_blank" href="/articles/setprompt-setting-matlab-desktop-prompt"><i><b>setPrompt</b></i></a> utilities.<br />
<center><figure style="width: 445px" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" alt="cprintf usage examples" src="https://undocumentedmatlab.com/images/cprintf.png" title="cprintf usage examples" width="445" height="228"/><figcaption class="wp-caption-text"><i><b>cprintf</b></i> usage examples</figcaption></figure> <figure style="width: 436px" class="wp-caption aligncenter"><img decoding="async" alt="setPrompt usage examples" src="https://undocumentedmatlab.com/images/setPrompt.png" title="setPrompt usage examples" width="436" height="228" /><figcaption class="wp-caption-text"><b><i>setPrompt</i></b> usage examples</figcaption></figure></center></p>
<h3 id="print">Printing GUIs reliably</h3>
<p>Matlab has always tried to be far too sophisticated for its own good when printing figures. There&#8217;s plenty of internal code that tries to handle numerous circumstances in the figure contents for optimal output. Unfortunately, this code also has many bugs. Try printing even a slightly-complex GUI containing panels and/or Java controls and you&#8217;ll see components overlapping each other, not being printed, and/or being rendered incorrectly in the printed output. Not to mention the visible flicker that happens when Matlab modifies the figure in preparation for printing, and then modifies it back to the original.<br />
All this when a simple printout of a screen-capture would be both much faster and 100% reliable.<br />
Which is where my <a target="_blank" href="/articles/screencapture-utility">ScreenCapture utility</a> comes in. Unlike Matlab&#8217;s <i><b>print</b></i> and <i><b>getframe</b></i>, <i><b>ScreenCapture</b></i> takes an actual screen-capture of an entire figure, or part of a figure (or even a desktop area outside any Matlab figure), and can then send the resulting image to a Matlab variable (2D RGB image), an image file, system clipboard, or the printer. We can <a target="_blank" href="/articles/modifying-default-toolbar-menubar-actions">easily modify the &lt;Print&gt; toolbar button and menu item</a> to use this utility rather than the builtin print function:<br />
<center><figure style="width: 463px" class="wp-caption aligncenter"><img decoding="async" alt="Matlab's default toolbar Print action" src="https://undocumentedmatlab.com/images/Toolbar_Menubar_actions2b.png" title="Matlab's default toolbar Print action" width="463" height="108" /><figcaption class="wp-caption-text">Matlab's default toolbar Print action</figcaption></figure></center></p>
<pre lang='matlab'>
hToolbar = findall(gcf,'tag','FigureToolBar');
hPrintButton = findall(hToolbar, 'tag','Standard.PrintFigure');
set(hPrintButton, 'ClickedCallback','screencapture(gcbf,[],''printer'')');
hPrintMenuItem = findall(gcf, 'type','uimenu', 'tag','printMenu');
set(hPrintMenuItem,      'Callback','screencapture(gcbf,[],''printer'')');
</pre>
<p>This prints the entire figure, including the frame, menubar and toolbar (if any). If you just wish to print the figure&#8217;s content area, then make sure to create a top-level <i><b>uipanel</b></i> that spans the entire content area and in which all the contents are included. Then simply pass this top-level container handle to <i><b>ScreenCapture</b></i>:</p>
<pre lang='matlab'>
hTopLevelContainer = uipanel('BorderType','none', 'Parent',gcf, 'Units','norm', 'Pos',[0,0,1,1]);
...
hToolbar = findall(gcf,'tag','FigureToolBar');
hPrintButton = findall(hToolbar, 'tag','Standard.PrintFigure');
set(hPrintButton, 'ClickedCallback',@(h,e)screencapture(hTopLevelContainer,[],'printer'));
hPrintMenuItem = findall(gcf, 'type','uimenu', 'tag','printMenu');
set(hPrintMenuItem,      'Callback',@(h,e)screencapture(hTopLevelContainer,[],'printer'));
</pre>
<p>In certain cases (depending on platform/OS/Matlab-release), the result may capture a few pixels from the figure&#8217;s window frame. This can easily be corrected by specifying a small offset to <i><b>ScreenCapture</b></i>:</p>
<pre lang='matlab'>
set(hPrintButton, 'ClickedCallback',@(h,e)printPanel(hTopLevelContainer));
set(hPrintMenuItem,      'Callback',@(h,e)printPanel(hTopLevelContainer));
function printPanel(hTopLevelContainer)
    pos = getpixelposition(hTopLevelContainer);
    screencapture(hTopLevelContainer, pos+[2,4,0,0], 'printer');
end
</pre>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds">Another couple of Matlab bugs and workarounds</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds" rel="bookmark" title="A couple of internal Matlab bugs and workarounds">A couple of internal Matlab bugs and workarounds </a> <small>A couple of undocumented Matlab bugs have simple workarounds. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part2" rel="bookmark" title="Explicit multi-threading in Matlab part 2">Explicit multi-threading in Matlab part 2 </a> <small>Matlab performance can be improved by employing .Net (C#, VB, F# or C++) threads. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/explicit-multi-threading-in-matlab-part3" rel="bookmark" title="Explicit multi-threading in Matlab part 3">Explicit multi-threading in Matlab part 3 </a> <small>Matlab performance can be improved by employing POSIX threads in C/C++ code. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/the-hotlinks-feature" rel="bookmark" title="The HotLinks feature">The HotLinks feature </a> <small>feature('HotLinks') can be used to temporarily disable hyperlinks and other markups in the Matlab console. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds/feed</wfw:commentRss>
			<slash:comments>32</slash:comments>
		
		
			</item>
		<item>
		<title>A couple of internal Matlab bugs and workarounds</title>
		<link>https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=couple-of-bugs-and-workarounds</link>
					<comments>https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 12 Jun 2013 18:00:23 +0000</pubDate>
				<category><![CDATA[Figure window]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Low risk of breaking in future versions]]></category>
		<category><![CDATA[Stock Matlab function]]></category>
		<category><![CDATA[Undocumented feature]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[GUIDE]]></category>
		<category><![CDATA[Pure Matlab]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3865</guid>

					<description><![CDATA[<p>A couple of undocumented Matlab bugs have simple workarounds. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds">A couple of internal Matlab bugs and workarounds</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds" rel="bookmark" title="Another couple of Matlab bugs and workarounds">Another couple of Matlab bugs and workarounds </a> <small>A couple of internal Matlab bugs and their workarounds. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/matlabs-internal-memory-representation" rel="bookmark" title="Matlab&#039;s internal memory representation">Matlab&#039;s internal memory representation </a> <small>Matlab's internal memory structure is explored and discussed. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/internal-matlab-memory-optimizations" rel="bookmark" title="Internal Matlab memory optimizations">Internal Matlab memory optimizations </a> <small>Copy-on-write and in-place data manipulations are very useful Matlab performance improvement techniques. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/accessing-internal-java-class-members" rel="bookmark" title="Accessing internal Java class members">Accessing internal Java class members </a> <small>Java inner classes and enumerations can be used in Matlab with a bit of tweaking. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>Like any other major software package, Matlab too has <a target="_blank" rel="nofollow" href="http://www.mathworks.com/support/bugreports/">its share of bugs</a>. If you ask me, the number of known bugs in Matlab is actually very small compared to the industry standard. Posting bugs online saves the support staff work on duplicates and provides immediate relief for users if the bug happens to have a posted workaround. It also increases transparency, which helps customer loyalty and confidence in the product. Serious engineering work that relies on Matlab for anything from designing cars and planes to trading on stock exchanges needs to be aware of all the current bugs, in order to avoid them in the production code.<br />
Unfortunately, for some reason MathWorks does not publicize all the bugs that it knows about. I know this since there are multiple bugs that I have reported and were confirmed by the competent technical support staff, which do not appear on the online list. I do not know whether this is a deliberate MathWorks policy based on some criteria, but I would hope not and I hope it will be fixed. IMHO, Matlab in general is a very stable system that has absolutely nothing to be ashamed of in terms of the low number, and relatively low-impact, of its open bugs.<br />
Today I write about two internal Matlab bugs that I have recently discovered and reported, along with their workarounds. None of them is really critical, but since neither appears in the official bug parade (as of today), I figured it would do some public good to post them here.<br />
<span id="more-3865"></span></p>
<h3 id="clf">The <i>clf</i> function does not clear <i>javacomponent</i>s (1-MNELS1)</h3>
<p>The <i><b>clf</b></i> function clears the specified figure window (or the current figure [<i><b>gcf</b></i>] if no figure handle was specified as input) of any axes and GUI controls. At least, that what it is supposed to do and what it did pretty well until R2012a (Matlab 7.14). Apparently, in R2012b (Matlab 8.0) something broke and controls that are added to the figure window using the <a target="_blank" href="/articles/javacomponent/"><i><b>javacomponent</b></i> function</a> are no longer cleared by <i><b>clf</b></i> &#8211; all the regular Matlab axes and uicontrols are deleted, but not the Java controls.</p>
<pre lang='matlab'>
figure;
[jButton, hContainer] = javacomponent(javax.swing.JButton('Click'), [], gcf);
drawnow;
clf  % bug - clf does not delete the jButton/hContainer component from the figure
</pre>
<p>There are several possible workarounds:</p>
<ol>
<li>Keep the handles of all the relevant Java components, and then <i><b>delete</b></i> them directly:
<pre lang='matlab'>delete(hContainer)</pre>
</li>
<li>Use <i><b>findobj</b></i> to delete all components, rather than the <i><b>clf</b></i> function (we use <i><b>setdiff</b></i> to prevent deletion of the figure window itself):
<pre lang='matlab'>delete(setdiff(findobj(gcf),gcf))</pre>
</li>
</ol>
<p>Note that this bug does not occur when using <a target="_blank" href="/articles/hg2-update/">HG2</a>. However, for users who use the still-standard HG1, this bug is still unfixed as of Matlab R2013b Pre-release (which is now available for download for subscribed users).</p>
<h3 id="guide">GUIDE is unusable with <i>dbstop if error</i> (1-MH5KVI)</h3>
<p>In R2013a (Matlab 8.1) I encounter a recurring error when attempting to inspect properties of objects in GUIDE, when &#8220;<i><b>dbstop if error</b></i>&#8221; is turned on.<br />
The error happens when I have &#8220;<i><b>dbstop if error</b></i>&#8221; enabled. This is an <a target="_blank" rel="nofollow" href="http://blogs.mathworks.com/videos/2013/04/08/using-dbstop-if-error-and-conditional-breakpoints-to-debug-matlab/">enormously helpful</a> debugging tool, so I normally have it turned on in my startup.m file. But in R2013a, if I try to inspect an object&#8217;s properties in GUIDE, I see a problem. Matlab hits the breakpoint in <i>%matlabroot%/toolbox/matlab/codetools/+internal/+matlab/+inspector/SceneViewerListener.m</i> line 99 due to the fact that <i>isvalid()</i> is not defined for the object, and the inspector window remains blank.<br />
How to reproduce:</p>
<ul>
<li>run &#8220;<i><b>dbstop if error</b></i>&#8221; in the Matlab command window</li>
<li>open a <i>*.fig</i> file in the Matlab command window (e.g., &#8220;<i><b>guide myApplication.fig</b></i>&#8220;)</li>
<li>right-click and inspect the properties for an axes (for example)</li>
<li>wait for the breakpoint to occur &#8211; &#8220;K&gt;&gt;&#8221; in the command window; the Editor stops (green arrow) in <i>SceneViewerListener.m</i> line 99</li>
<li>an empty inspector window is displayed</li>
</ul>
<p>Analysis:<br />
Because <i>SceneViewerListener</i> is called from Java, not Matlab, the error is thrown as an exception that is trapped by the Java code and therefore does not appear to the user unless &#8220;<i><b>dbstop if error</b></i>&#8221; is on. Here is the full stack trace at the point of error (see <a target="_blank" href="/articles/java-stack-traces-in-matlab/">this post</a> regarding how to generate the Java stack dump):</p>
<pre lang='matlab'>
K>> dbstack
> In SceneViewerListener>SceneViewerListener.isBeingDeleted at 99
K>> st = java.lang.Thread.currentThread.getStackTrace; for idx = 2 : length(st), disp(st(idx)); end
com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:219)
com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:120)
com.mathworks.jmi.Matlab.mtFeval(Matlab.java:1540)
com.mathworks.mlwidgets.inspector.JidePropertyViewTable.isBeingDeleted(JidePropertyViewTable.java:154)
com.mathworks.mlwidgets.inspector.JidePropertyViewTable.filterOutInvalidObjects(JidePropertyViewTable.java:170)
com.mathworks.mlwidgets.inspector.JidePropertyViewTable.setObjects_MatlabThread(JidePropertyViewTable.java:187)
com.mathworks.mlwidgets.inspector.PropertyView.setObject_MatlabThread(PropertyView.java:655)
com.mathworks.mlwidgets.inspector.PropertyView.setObject_AnyThread(PropertyView.java:591)
com.mathworks.mlwidgets.inspector.PropertyView.access$1300(PropertyView.java:37)
com.mathworks.mlwidgets.inspector.PropertyView$RegistryHandler.itemStateChanged(PropertyView.java:698)
java.awt.AWTEventMulticaster.itemStateChanged(Unknown Source)
com.mathworks.services.ObjectRegistry.fireItemEvent(ObjectRegistry.java:763)
com.mathworks.services.ObjectRegistry.setSelected(ObjectRegistry.java:700)
com.mathworks.services.ObjectRegistry.setSelected(ObjectRegistry.java:617)
com.mathworks.mde.inspector.Inspector.setSelected(Inspector.java:584)
com.mathworks.mde.inspector.Inspector.inspectObjectArray(Inspector.java:569)
com.mathworks.mde.inspector.Inspector.inspectObjectArray(Inspector.java:520)
com.mathworks.mde.inspector.Inspector$11.run(Inspector.java:478)
com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:347)
</pre>
<p>Workaround:<br />
replace the existing code of <i>SceneViewerListener.m</i>:</p>
<pre lang='matlab'>
>> edit internal.matlab.inspector.SceneViewerListener
...
if ~isvalid(selectedObject)
    beingDeleted = true;
elseif isprop(selectedObject,'BeingDeleted') && strcmp('on',selectedObject.BeingDeleted)
    beingDeleted = true;
elseif ~isempty(ancestor(selectedObject,'figure')) && strcmp('on',get(ancestor(selectedObject,'figure'),'BeingDeleted'))
    beingDeleted = true;
else
    beingDeleted = false;
end
</pre>
<p>with the following (changed lines are highlighted):</p>
<pre lang='matlab' highlight='1-3'>
if any(~isobject(selectedObject))
    beingDeleted = false;
elseif ~isValid
    beingDeleted = true;
elseif isprop(selectedObject,'BeingDeleted') && strcmp('on',selectedObject.BeingDeleted)
    beingDeleted = true;
elseif ~isempty(ancestor(selectedObject,'figure')) && strcmp('on',get(ancestor(selectedObject,'figure'),'BeingDeleted'))
    beingDeleted = true;
else
    beingDeleted = false;
end
</pre>
<p>It looks like this bug was apparently fixed in the R2013b Pre-release without needing to modify <i>SceneViewerListener</i>. But if you still encounter this problem you now know what to do.<br />
I have reported another GUIDE-related bug, but I do not have a workaround for this one: If you run the GUI from within GUIDE, and some uncaught error (exception) occurs, then from that moment onward you cannot save any modifications to the figure file in that session.<br />
Do you know of any other undocumented bugs, preferably with workarounds? If so, please post them in a comment <a href="/articles/couple-of-bugs-and-workarounds/#respond">here</a>.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds">A couple of internal Matlab bugs and workarounds</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/couple-of-matlab-bugs-and-workarounds" rel="bookmark" title="Another couple of Matlab bugs and workarounds">Another couple of Matlab bugs and workarounds </a> <small>A couple of internal Matlab bugs and their workarounds. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/matlabs-internal-memory-representation" rel="bookmark" title="Matlab&#039;s internal memory representation">Matlab&#039;s internal memory representation </a> <small>Matlab's internal memory structure is explored and discussed. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/internal-matlab-memory-optimizations" rel="bookmark" title="Internal Matlab memory optimizations">Internal Matlab memory optimizations </a> <small>Copy-on-write and in-place data manipulations are very useful Matlab performance improvement techniques. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/accessing-internal-java-class-members" rel="bookmark" title="Accessing internal Java class members">Accessing internal Java class members </a> <small>Java inner classes and enumerations can be used in Matlab with a bit of tweaking. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/couple-of-bugs-and-workarounds/feed</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
