<?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: Formatting numbers	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/formatting-numbers/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/formatting-numbers?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=formatting-numbers</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Tue, 05 Apr 2016 15:49: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: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-373758</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 05 Apr 2016 15:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-373758</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/formatting-numbers#comment-373742&quot;&gt;Collin&lt;/a&gt;.

@Collin - 
&lt;pre lang=&quot;matlab&quot;&gt;
sysClassLoader = java.lang.ClassLoader.getSystemClassLoader();
FieldClass = sysClassLoader.loadClass(&#039;java.text.NumberFormat$Field&#039;);
exponentField = FieldClass.getField(&#039;CURRENCY&#039;).get([]);
&lt;/pre&gt;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/formatting-numbers#comment-373742">Collin</a>.</p>
<p>@Collin &#8211; </p>
<pre lang="matlab">
sysClassLoader = java.lang.ClassLoader.getSystemClassLoader();
FieldClass = sysClassLoader.loadClass('java.text.NumberFormat$Field');
exponentField = FieldClass.getField('CURRENCY').get([]);
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Collin		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-373742</link>

		<dc:creator><![CDATA[Collin]]></dc:creator>
		<pubDate>Tue, 05 Apr 2016 09:20:21 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-373742</guid>

					<description><![CDATA[I need to format numbers with engineeering prefixes 1e3 to 1k, sometimes with units (1 kg).

Currently,I use DecimalFormat with the right prefix to get the exponent into groups of 3, than native matlab string handling and a hashtable to extract the correct prefic (exponent &#039;3&#039; = &#039;k&#039;), all well and good.  The FEX submission, num2sip (http://www.mathworks.com/matlabcentral/fileexchange/33174-number-to-scientific-prefix) does the same thing cleverer and all in native matlab.

My question is the use of a AttributedCharacterIterator and the attribute returned.  The attribute returned is a java.text.NumberFormat.Field object but takes the form java.text.NumberFormat$Field(exponent field) and I can not seem to create a java.text.NumberFormat.Field object in matlab.

Any help would be appreciated]]></description>
			<content:encoded><![CDATA[<p>I need to format numbers with engineeering prefixes 1e3 to 1k, sometimes with units (1 kg).</p>
<p>Currently,I use DecimalFormat with the right prefix to get the exponent into groups of 3, than native matlab string handling and a hashtable to extract the correct prefic (exponent &#8216;3&#8217; = &#8216;k&#8217;), all well and good.  The FEX submission, num2sip (<a href="http://www.mathworks.com/matlabcentral/fileexchange/33174-number-to-scientific-prefix" rel="nofollow ugc">http://www.mathworks.com/matlabcentral/fileexchange/33174-number-to-scientific-prefix</a>) does the same thing cleverer and all in native matlab.</p>
<p>My question is the use of a AttributedCharacterIterator and the attribute returned.  The attribute returned is a java.text.NumberFormat.Field object but takes the form java.text.NumberFormat$Field(exponent field) and I can not seem to create a java.text.NumberFormat.Field object in matlab.</p>
<p>Any help would be appreciated</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-329476</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 12 Aug 2014 08:22:51 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-329476</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/formatting-numbers#comment-329472&quot;&gt;Ori&lt;/a&gt;.

@Ori - you need to do it programmatically, there is no immediate solution for displaying a vector with different exponents.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/formatting-numbers#comment-329472">Ori</a>.</p>
<p>@Ori &#8211; you need to do it programmatically, there is no immediate solution for displaying a vector with different exponents.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ori		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-329472</link>

		<dc:creator><![CDATA[Ori]]></dc:creator>
		<pubDate>Tue, 12 Aug 2014 07:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-329472</guid>

					<description><![CDATA[Is there also a way to force a specific scientific notation power?

For example instead of Matlab displaying:

0.001e-3

Make it show 1.123e-6  ?

This is important sometimes when small numbers are part of a vector with larger values.

Thanks,

Ori]]></description>
			<content:encoded><![CDATA[<p>Is there also a way to force a specific scientific notation power?</p>
<p>For example instead of Matlab displaying:</p>
<p>0.001e-3</p>
<p>Make it show 1.123e-6  ?</p>
<p>This is important sometimes when small numbers are part of a vector with larger values.</p>
<p>Thanks,</p>
<p>Ori</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Grouping Digits &#124; Now		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-310453</link>

		<dc:creator><![CDATA[Grouping Digits &#124; Now]]></dc:creator>
		<pubDate>Mon, 20 Jan 2014 05:03:20 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-310453</guid>

					<description><![CDATA[[...] I don&#8217;t have to face this issue in the context of international banking, like what he had (http://undocumentedmatlab.com/blog/formatting-numbers/). So I&#8217;m particularly grateful that the expert has written a *simple* article to illustrate [...]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] I don&#8217;t have to face this issue in the context of international banking, like what he had (<a href="http://undocumentedmatlab.com/blog/formatting-numbers/" rel="ugc">http://undocumentedmatlab.com/blog/formatting-numbers/</a>). So I&#8217;m particularly grateful that the expert has written a *simple* article to illustrate [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Donn Shull		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-55295</link>

		<dc:creator><![CDATA[Donn Shull]]></dc:creator>
		<pubDate>Mon, 29 Aug 2011 15:35:45 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-55295</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/formatting-numbers#comment-55278&quot;&gt;Mikhail&lt;/a&gt;.

except for your next to last example you could use the &lt;i&gt;&lt;b&gt;sprintf&lt;/b&gt;&lt;/i&gt; option as follows:

&lt;pre lang=&quot;matlab&quot;&gt; 
for index = [0,2,4,5,7,8,10,11], disp(sprintf(&#039;%6.4g&#039;, 0.000012345678*10^index)); end
1.235e-005
0.001235
0.1235
1.235
123.5
1235
1.235e+005
1.235e+006 
&lt;/pre&gt;

perhaps there are other solutions.

Donn]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/formatting-numbers#comment-55278">Mikhail</a>.</p>
<p>except for your next to last example you could use the <i><b>sprintf</b></i> option as follows:</p>
<pre lang="matlab"> 
for index = [0,2,4,5,7,8,10,11], disp(sprintf('%6.4g', 0.000012345678*10^index)); end
1.235e-005
0.001235
0.1235
1.235
123.5
1235
1.235e+005
1.235e+006 
</pre>
<p>perhaps there are other solutions.</p>
<p>Donn</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Mikhail		</title>
		<link>https://undocumentedmatlab.com/articles/formatting-numbers#comment-55278</link>

		<dc:creator><![CDATA[Mikhail]]></dc:creator>
		<pubDate>Mon, 29 Aug 2011 09:04:48 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=2413#comment-55278</guid>

					<description><![CDATA[Do you have a solution to format doubles leaving n (say 4) significant digits for pos/neg numbers between for example [1e-5, 1e+5] and scientific notation for very large/small numbers like in example below?

0.000012345678  -&#062;  1.235e-005
0.001234567898  -&#062;  0.001235
0.123456789876  -&#062;  0.1235
1.234567898765  -&#062;  1.235
123.4567898765  -&#062;  123.5
1234.567898765  -&#062;  1235
123456.7898765  -&#062;  123457
1234567.898765  -&#062;  1.234e+006]]></description>
			<content:encoded><![CDATA[<p>Do you have a solution to format doubles leaving n (say 4) significant digits for pos/neg numbers between for example [1e-5, 1e+5] and scientific notation for very large/small numbers like in example below?</p>
<p>0.000012345678  -&gt;  1.235e-005<br />
0.001234567898  -&gt;  0.001235<br />
0.123456789876  -&gt;  0.1235<br />
1.234567898765  -&gt;  1.235<br />
123.4567898765  -&gt;  123.5<br />
1234.567898765  -&gt;  1235<br />
123456.7898765  -&gt;  123457<br />
1234567.898765  -&gt;  1.234e+006</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
