<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8302916381344297037</id><updated>2024-09-05T15:31:28.427-07:00</updated><category term="MATLAB"/><category term="Append"/><category term="BINARY ARRAY MATLAB"/><category term="Excel"/><category term="Matab"/><category term="Matlab X-tick"/><category term="Sort"/><category term="Sorting by another sorting"/><category term="Student&#39;s t-distribution"/><category term="TRUE FALSE MATLAB"/><category term="Undo SORT"/><category term="disk"/><category term="label change"/><category term="legend"/><category term="legend in errorbar"/><category term="multiple legend"/><category term="save matlab figure"/><category term="subplot"/><category term="t-distribution"/><category term="two tailed P value"/><category term="uigetfile"/><category term="user defined input file"/><category term="variable in title"/><title type='text'>Learning Yourself Matlab</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-1335032866781878396</id><published>2012-07-06T08:23:00.001-07:00</published><updated>2012-07-06T08:24:06.253-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="label change"/><category scheme="http://www.blogger.com/atom/ns#" term="Matlab X-tick"/><title type='text'>In MATLAB figure, how to change the X or Y axis ticks or labels?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
A default case is the following where I plot 100 random numbers&lt;br /&gt;
&lt;br /&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
var=rand(1,100);&lt;br /&gt;
figure; plot(1:100,var,&#39;--rs&#39;);&lt;br /&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZi7iTXkQfisgCgsYQUFjG-pPUb2Z-GoMGsAU2a1cs5a6u_o5anzA5vjuO5OsM8wf00eEuvobElI_1tvnWd3H4AYCJxmCBnqEkbvD-NglDBJagy-d82QYpva6by5Il9EIwMcneaNPFDvFI/s1600/1_plot_100_random_numbers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;304&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZi7iTXkQfisgCgsYQUFjG-pPUb2Z-GoMGsAU2a1cs5a6u_o5anzA5vjuO5OsM8wf00eEuvobElI_1tvnWd3H4AYCJxmCBnqEkbvD-NglDBJagy-d82QYpva6by5Il9EIwMcneaNPFDvFI/s640/1_plot_100_random_numbers.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;In X axis, the labels are placed 10 places apart.....0....10....20....30..... like that....If I want to have labels 2 places apart &amp;nbsp;1...3...5....7 till 100 how may I do it?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
&lt;br /&gt;
set(gca,&#39;XTick&#39;,1:10:100) % Here gca refers to the handler of the current figure&#39;s axis &lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSogE3wV4OvrWl2nND-UN9TS54EVUeo-sIZuJV8nG8UIoLlExFHirPVSULsxj-4BlPVM00CbHfrrWHQMOFWmI7MdPIWXPmJ-epBz1opAx1SCuge55oK0RRZiNz_Mudjg72UUZ0x6tvcR-s/s1600/plot_100_random_numbers.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;304&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSogE3wV4OvrWl2nND-UN9TS54EVUeo-sIZuJV8nG8UIoLlExFHirPVSULsxj-4BlPVM00CbHfrrWHQMOFWmI7MdPIWXPmJ-epBz1opAx1SCuge55oK0RRZiNz_Mudjg72UUZ0x6tvcR-s/s640/plot_100_random_numbers.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now, try to do the same in Y-axis! Share your result :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/1335032866781878396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/in-matlab-figure-how-to-change-x-or-y.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/1335032866781878396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/1335032866781878396'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/in-matlab-figure-how-to-change-x-or-y.html' title='In MATLAB figure, how to change the X or Y axis ticks or labels?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZi7iTXkQfisgCgsYQUFjG-pPUb2Z-GoMGsAU2a1cs5a6u_o5anzA5vjuO5OsM8wf00eEuvobElI_1tvnWd3H4AYCJxmCBnqEkbvD-NglDBJagy-d82QYpva6by5Il9EIwMcneaNPFDvFI/s72-c/1_plot_100_random_numbers.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-4979217397339046744</id><published>2012-07-05T07:14:00.001-07:00</published><updated>2012-07-05T07:14:45.667-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="disk"/><category scheme="http://www.blogger.com/atom/ns#" term="save matlab figure"/><title type='text'>How to save/print MATLAB figure in a file?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Imagine I want to print/save a matlab figure into disk. May be I want to save it in PNG format. How do I do that?&lt;br /&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
&lt;br /&gt;
file_handler=figure;&lt;br /&gt;
plot(randn(10,1));&lt;br /&gt;
print(file_handler,&#39;-dpng&#39;, &#39;my_file_name.png&#39;);&lt;br /&gt;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
Check your current folder. A file named&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;my_file_name.png should be there!&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSLJpseosZlClhoMPbksPKiuOyNDR3oB57j3Q8kr2B6LQN4m0y0F04eZ8nh016F8ID4ApKixfZobrLnJend4e4KCGLR3-mzHMXcK9NTH54bzMstC7lNWKOg-LLEqdeo5Udi-lJtP2gR-Y9/s1600/my_file_name.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSLJpseosZlClhoMPbksPKiuOyNDR3oB57j3Q8kr2B6LQN4m0y0F04eZ8nh016F8ID4ApKixfZobrLnJend4e4KCGLR3-mzHMXcK9NTH54bzMstC7lNWKOg-LLEqdeo5Udi-lJtP2gR-Y9/s400/my_file_name.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/4979217397339046744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/how-to-saveprint-matlab-figure-in-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/4979217397339046744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/4979217397339046744'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/how-to-saveprint-matlab-figure-in-file.html' title='How to save/print MATLAB figure in a file?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSLJpseosZlClhoMPbksPKiuOyNDR3oB57j3Q8kr2B6LQN4m0y0F04eZ8nh016F8ID4ApKixfZobrLnJend4e4KCGLR3-mzHMXcK9NTH54bzMstC7lNWKOg-LLEqdeo5Udi-lJtP2gR-Y9/s72-c/my_file_name.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-7022423506124556468</id><published>2012-07-05T07:06:00.000-07:00</published><updated>2012-07-05T07:06:40.546-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="variable in title"/><title type='text'>How to print variable value in title of a matlab figure?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Imagine my MATLAB figure has a title where I want to print the value of a variable. How can I do that ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for var=1:3&lt;br /&gt;
figure;&lt;br /&gt;
plot(randn(10,1)); title([&#39;rand number=: &#39; num2str(var) ]);&lt;br /&gt;
end&lt;br /&gt;
%%%%%%%%%%%%%%%%%%Out Put%%%%%%%%%%%%%%%%%%%%%%%%%%&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWk6TmZSFttDliSBYLnfwu_CSUsuV_PwkMEZUFQiZZpBa8hHSNEN23fxOwIC0qRbvzQEGUBanMOHTtfW6sSO9Ri6s07vgVMRnqhXzel_nxQJTYHG5H1CjY_PeTr9Tai_bGBOdPS-vUiFa0/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWk6TmZSFttDliSBYLnfwu_CSUsuV_PwkMEZUFQiZZpBa8hHSNEN23fxOwIC0qRbvzQEGUBanMOHTtfW6sSO9Ri6s07vgVMRnqhXzel_nxQJTYHG5H1CjY_PeTr9Tai_bGBOdPS-vUiFa0/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM0pSFBxKSLVBKhXJEt5bZNHhucjFgRYmJLkDxYCVRxxuh5KerFGa5tgmSF2kQI4dDPAFoevpKpj7zJsWaRC223SOmLuwzJizrecTA9-xUGcjv-nEctcUJgPaTrKw4wHta-jVtAOWNI_NG/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM0pSFBxKSLVBKhXJEt5bZNHhucjFgRYmJLkDxYCVRxxuh5KerFGa5tgmSF2kQI4dDPAFoevpKpj7zJsWaRC223SOmLuwzJizrecTA9-xUGcjv-nEctcUJgPaTrKw4wHta-jVtAOWNI_NG/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHoLPIQOqyD7e2GZHepLU_giMw7s5aLP8LTWDyNug2LJwWk27Lpk_7tIZIPFThEsVs5JrDNRTL5ErfpOEyTgCVod9NzyPYqt0yPWjFZRAlNnWiChJj4oISMNQ58H3BqAaV7C_YdaLMn39-/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHoLPIQOqyD7e2GZHepLU_giMw7s5aLP8LTWDyNug2LJwWk27Lpk_7tIZIPFThEsVs5JrDNRTL5ErfpOEyTgCVod9NzyPYqt0yPWjFZRAlNnWiChJj4oISMNQ58H3BqAaV7C_YdaLMn39-/s400/3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/7022423506124556468/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/how-to-print-variable-value-in-title-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/7022423506124556468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/7022423506124556468'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/how-to-print-variable-value-in-title-of.html' title='How to print variable value in title of a matlab figure?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWk6TmZSFttDliSBYLnfwu_CSUsuV_PwkMEZUFQiZZpBa8hHSNEN23fxOwIC0qRbvzQEGUBanMOHTtfW6sSO9Ri6s07vgVMRnqhXzel_nxQJTYHG5H1CjY_PeTr9Tai_bGBOdPS-vUiFa0/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-1660355701661745395</id><published>2012-07-05T03:17:00.001-07:00</published><updated>2012-07-05T03:17:09.992-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="multiple legend"/><title type='text'>Multiple Legend in plot/subplot</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
I needed multiple legend on a plot for multiple data where data sizes were different. If try classical legend you get the following&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp; &amp;nbsp;figure&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; p1=plot(I_test(:,:,1),I_true(:,:,1),&#39;r.&#39;);&lt;br /&gt;
&amp;nbsp; hold on&lt;br /&gt;
&amp;nbsp; p2=plot(RGB_test(:,1),RGB_ref(:,1),&#39;g.&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; legend( &#39;true&#39;,&#39;calculated&#39;);&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;It does not give what I want !! Therefore.....continue reading..&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG3DSSr86xNz6DPpA2v0WRjcJt7NYQwPbyZD6XaYAryyjt0-nQyokfrl9Jwpztttjl5TvLkqG2GDSmogQtoT6CM773ocFYUJ8vqF-sal924lh4KeJjUaWu1_hraso8gAQT5w1JgEBQu5Sw/s1600/classical+legend.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG3DSSr86xNz6DPpA2v0WRjcJt7NYQwPbyZD6XaYAryyjt0-nQyokfrl9Jwpztttjl5TvLkqG2GDSmogQtoT6CM773ocFYUJ8vqF-sal924lh4KeJjUaWu1_hraso8gAQT5w1JgEBQu5Sw/s400/classical+legend.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
Instead try the following to have different legend&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;figure&lt;br /&gt;
&amp;nbsp; p1=plot(I_test(:,:,1),I_true(:,:,1),&#39;r.&#39;);&lt;br /&gt;
&amp;nbsp; hold on&lt;br /&gt;
&amp;nbsp; p2=plot(RGB_test(:,1),RGB_ref(:,1),&#39;g.&#39;);&lt;br /&gt;
&amp;nbsp; legend([p1(1) p2(end)], &#39;true&#39;,&#39;calculated&#39;);&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQU8KczOTKKzlnLNKX6rso0ijLJ9zHkd_GHqaf4oleG4w75jBSZba35F5LRbIvPZBI61q8YwVH1rOtX6BjLjhLxiWNqGuyzVhim-XqZTmn8llyyySQ-XqOJmxWZdqYOvbFiCxFORvkFo4X/s1600/non+classical+legend.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQU8KczOTKKzlnLNKX6rso0ijLJ9zHkd_GHqaf4oleG4w75jBSZba35F5LRbIvPZBI61q8YwVH1rOtX6BjLjhLxiWNqGuyzVhim-XqZTmn8llyyySQ-XqOJmxWZdqYOvbFiCxFORvkFo4X/s400/non+classical+legend.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/1660355701661745395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/multiple-legend-in-plotsubplot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/1660355701661745395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/1660355701661745395'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/multiple-legend-in-plotsubplot.html' title='Multiple Legend in plot/subplot'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG3DSSr86xNz6DPpA2v0WRjcJt7NYQwPbyZD6XaYAryyjt0-nQyokfrl9Jwpztttjl5TvLkqG2GDSmogQtoT6CM773ocFYUJ8vqF-sal924lh4KeJjUaWu1_hraso8gAQT5w1JgEBQu5Sw/s72-c/classical+legend.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-2823115898291876074</id><published>2012-07-05T02:27:00.002-07:00</published><updated>2012-07-05T02:30:43.529-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="legend"/><category scheme="http://www.blogger.com/atom/ns#" term="subplot"/><title type='text'>Legend in Subplot</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Acknowledgement : &lt;a href=&quot;http://www.mathworks.com/matlabcentral/newsreader/view_thread/162450&quot;&gt;here&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; subplot(2,2,1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;ph1=plot(rand(10,2),&#39;s-&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;subplot(2,2,3:4);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;ph2=plot(rand(10,3),&#39;o-&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;sh=subplot(2,2,2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;p=get(sh,&#39;position&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;lh=legend(sh,[ph1;ph2]);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;set(lh,&#39;position&#39;,p);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;axis(sh,&#39;off&#39;);&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP4p98zwX0__VRq6XlLlBBbeUxQHsgqgeF4sZEL-zdvyDLSK0qiwsqe1SYe49-clafJzU0C-gch_Ig8417VH3SjroXvO6YxUuPfjQpelAJxtR6_gN9l7ByNeHtNPddzTppqaSW0PqvYRaH/s1600/legend+in+subplot.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP4p98zwX0__VRq6XlLlBBbeUxQHsgqgeF4sZEL-zdvyDLSK0qiwsqe1SYe49-clafJzU0C-gch_Ig8417VH3SjroXvO6YxUuPfjQpelAJxtR6_gN9l7ByNeHtNPddzTppqaSW0PqvYRaH/s400/legend+in+subplot.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/2823115898291876074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/legend-in-subplot.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/2823115898291876074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/2823115898291876074'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/07/legend-in-subplot.html' title='Legend in Subplot'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP4p98zwX0__VRq6XlLlBBbeUxQHsgqgeF4sZEL-zdvyDLSK0qiwsqe1SYe49-clafJzU0C-gch_Ig8417VH3SjroXvO6YxUuPfjQpelAJxtR6_gN9l7ByNeHtNPddzTppqaSW0PqvYRaH/s72-c/legend+in+subplot.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-447831537674086246</id><published>2012-03-12T13:45:00.001-07:00</published><updated>2012-03-12T13:45:18.622-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="legend in errorbar"/><category scheme="http://www.blogger.com/atom/ns#" term="MATLAB"/><title type='text'>Matlab: legend in Errorbar</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgRkl5NahTKsOXij33LycEPuUlbyZOn9aX0kw0tfp6v633LTJidW8RRATYgLEFsZSBgUV5YJAk3ymtUmnGRuC8BZyQjly9VJDQm_u5IW9lm_7ptlXDxIjBsKQO0gWc8eZcedOh72FON6Rc/s1600/error_bar.tif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgRkl5NahTKsOXij33LycEPuUlbyZOn9aX0kw0tfp6v633LTJidW8RRATYgLEFsZSBgUV5YJAk3ymtUmnGRuC8BZyQjly9VJDQm_u5IW9lm_7ptlXDxIjBsKQO0gWc8eZcedOh72FON6Rc/s400/error_bar.tif&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
I want to generate an error bar like this. Here, I am comparing three algorithms and I need three legends. Here is how I did it&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
y = [2.22153808961105&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;2.49790518623828&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;2.78257964160148]; % mean or average&lt;br /&gt;
e = [0.539408440954881&amp;nbsp;1.23204940330217&amp;nbsp;0.813491394996712]; % 1 standard deviation&lt;br /&gt;
figure&lt;br /&gt;
errorbar(y,e,&#39;r.&#39;);&lt;br /&gt;
hold on;&lt;br /&gt;
h=plot(1,y(1),&#39;ro&#39;,2,y(2),&#39;go&#39;,3,y(3),&#39;bo&#39;);&lt;br /&gt;
legend(h,&#39;feature&#39;,&#39;feature3x3&#39;,&#39;cluster&#39;,&#39;Location&#39;,&#39;Best&#39;);&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/447831537674086246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/03/matlab-legend-in-errorbar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/447831537674086246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/447831537674086246'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/03/matlab-legend-in-errorbar.html' title='Matlab: legend in Errorbar'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgRkl5NahTKsOXij33LycEPuUlbyZOn9aX0kw0tfp6v633LTJidW8RRATYgLEFsZSBgUV5YJAk3ymtUmnGRuC8BZyQjly9VJDQm_u5IW9lm_7ptlXDxIjBsKQO0gWc8eZcedOh72FON6Rc/s72-c/error_bar.tif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-7733105212369159681</id><published>2012-02-24T06:30:00.001-08:00</published><updated>2012-02-24T06:30:31.463-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MATLAB"/><category scheme="http://www.blogger.com/atom/ns#" term="Sort"/><category scheme="http://www.blogger.com/atom/ns#" term="Sorting by another sorting"/><title type='text'>In Matlab : Sorting by indexes of another sorting</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Imagine, we have the following two array of numbers&lt;br /&gt;
A=[ 2 4 6 7 8 8];&lt;br /&gt;
&amp;nbsp;B=[ 5 8 2 5 0 5];&lt;br /&gt;
Problem:&lt;br /&gt;
---------&lt;br /&gt;
we want to sort A and then arrange B according to the index of A.&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
----------&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; [sortedA,indexA]=sort(A)&lt;br /&gt;
&lt;br /&gt;
sortedA =&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 8 &amp;nbsp; &amp;nbsp; 8&lt;br /&gt;
&lt;br /&gt;
indexA =&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 6&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt; B(indexA)&lt;br /&gt;
&lt;br /&gt;
ans =&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; 8 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; 5&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/7733105212369159681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/02/in-matlab-sorting-by-indexes-of-another.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/7733105212369159681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/7733105212369159681'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/02/in-matlab-sorting-by-indexes-of-another.html' title='In Matlab : Sorting by indexes of another sorting'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-3950299925830222496</id><published>2012-02-16T15:39:00.001-08:00</published><updated>2012-02-16T15:39:46.850-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Append"/><category scheme="http://www.blogger.com/atom/ns#" term="Excel"/><category scheme="http://www.blogger.com/atom/ns#" term="MATLAB"/><title type='text'>How to append in a excel file using Matlab?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Imagine that I have the following excel file called &quot;algoperformace.xls&quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 473px;&quot;&gt;
 &lt;colgroup&gt;&lt;col style=&quot;mso-width-alt: 5705; mso-width-source: userset; width: 117pt;&quot; width=&quot;156&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-alt: 3072; mso-width-source: userset; width: 63pt;&quot; width=&quot;84&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-alt: 3108; mso-width-source: userset; width: 64pt;&quot; width=&quot;85&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;mso-width-alt: 3072; mso-width-source: userset; width: 63pt;&quot; width=&quot;84&quot;&gt;&lt;/col&gt;
 &lt;col style=&quot;width: 48pt;&quot; width=&quot;64&quot;&gt;&lt;/col&gt;
 &lt;/colgroup&gt;&lt;tbody&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl65&quot; height=&quot;20&quot; style=&quot;height: 15.0pt; width: 117pt;&quot; width=&quot;156&quot;&gt;algoName&lt;/td&gt;
  &lt;td class=&quot;xl65&quot; style=&quot;border-left: none; width: 63pt;&quot; width=&quot;84&quot;&gt;mode&lt;/td&gt;
  &lt;td class=&quot;xl65&quot; style=&quot;border-left: none; width: 64pt;&quot; width=&quot;85&quot;&gt;95percentile&lt;/td&gt;
  &lt;td class=&quot;xl65&quot; style=&quot;border-left: none; width: 63pt;&quot; width=&quot;84&quot;&gt;max&lt;/td&gt;
  &lt;td class=&quot;xl65&quot; style=&quot;border-left: none; width: 48pt;&quot; width=&quot;64&quot;&gt;mean&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl65&quot; height=&quot;20&quot; style=&quot;border-top: none; height: 15.0pt;&quot;&gt;Algorithm1&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;13.15153679&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;20.03323188&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;39.52043729&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; border-top: none;&quot;&gt;15.65858&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;br /&gt;
Now, I would like to add a new line as the following into this excel file using matlab&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse: collapse; width: 473px;&quot;&gt;&lt;tbody&gt;
&lt;tr height=&quot;20&quot; style=&quot;height: 15.0pt;&quot;&gt;
  &lt;td class=&quot;xl65&quot; height=&quot;20&quot; style=&quot;height: 15.0pt; width: 117pt;&quot; width=&quot;156&quot;&gt;Neighbor&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; width: 63pt;&quot; width=&quot;84&quot;&gt;2.721678458&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; width: 64pt;&quot; width=&quot;85&quot;&gt;5.536962451&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; width: 63pt;&quot; width=&quot;84&quot;&gt;26.63633753&lt;/td&gt;
  &lt;td align=&quot;right&quot; class=&quot;xl65&quot; style=&quot;border-left: none; width: 48pt;&quot; width=&quot;64&quot;&gt;3.858783&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;br /&gt;
How to do that?&lt;br /&gt;
----------------------------------------------------------------------------------&lt;br /&gt;
Answer:&lt;br /&gt;
%% Loading the excel into matlab&lt;br /&gt;
&lt;br /&gt;
[~, ~, alldata] = xlsread(&#39;algperformace.xls&#39;);&lt;br /&gt;
% We will add new entry line into &#39;alldata&#39; variable and then will write the excel file &lt;br /&gt;
% The script will compute the value for&amp;nbsp;algoname, mode, color_diff_95_percentile, max, mean&lt;br /&gt;
% adding those values into the cell of &#39;alldata&#39;&lt;br /&gt;
alldata(size(alldata,1),:)={algoname, mode, color_diff_95_percentile, max, mean};&lt;br /&gt;
%writing the complete new &#39;alldata&#39; into the same excel file&lt;br /&gt;
xlswrite(&#39;algperformace.xls&#39;, alldata);&lt;br /&gt;
&lt;br /&gt;
Try your own example :)&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/3950299925830222496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/02/how-to-append-in-excel-file-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/3950299925830222496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/3950299925830222496'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/02/how-to-append-in-excel-file-using.html' title='How to append in a excel file using Matlab?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-7820826063600079125</id><published>2012-02-02T05:38:00.000-08:00</published><updated>2012-02-02T05:38:50.766-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Matab"/><category scheme="http://www.blogger.com/atom/ns#" term="uigetfile"/><category scheme="http://www.blogger.com/atom/ns#" term="user defined input file"/><title type='text'>How may I make the user to browse and select file in Matlab</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Very often, Matlab programs need to specify input files or images. Instead of giving the absolute path to that file we may make the user to browse and locate the file.&lt;br /&gt;
&lt;br /&gt;
uigetfile is the function that can do that job. Here is an example.&lt;br /&gt;
&lt;br /&gt;
disp(&#39;Select the Reference view&#39;);&lt;br /&gt;
[filename_ref,pathname_ref] = uigetfile(&#39;*.*&#39;,&#39;Select the Reference view&#39;);&lt;br /&gt;
if isequal(filename_ref,0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; disp(&#39;User selected Cancel&#39;)&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; disp([&#39;Reference view: &#39;, fullfile(pathname_ref, filename_ref)])&lt;br /&gt;
end&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/7820826063600079125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/02/how-may-i-make-user-to-browse-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/7820826063600079125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/7820826063600079125'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2012/02/how-may-i-make-user-to-browse-and.html' title='How may I make the user to browse and select file in Matlab'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-829168951509458948</id><published>2011-12-15T02:09:00.000-08:00</published><updated>2011-12-15T02:09:36.394-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BINARY ARRAY MATLAB"/><category scheme="http://www.blogger.com/atom/ns#" term="TRUE FALSE MATLAB"/><title type='text'>How to use binary variable/ TRUE FALSE in MATLAB?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
You know in C++ you may write the following&lt;br /&gt;
&lt;br /&gt;
bool binary_variable=TRUE; // Or FALSE&lt;br /&gt;
&lt;br /&gt;
But How to do that in MATLAB?&lt;br /&gt;
&lt;br /&gt;
&amp;gt;&amp;gt;true([m, n])&lt;br /&gt;
This will create an m-by-n matrix of binary (logical) ones // TRUE&lt;br /&gt;
&amp;gt;&amp;gt;false&amp;nbsp;([m, n])&lt;br /&gt;
For&amp;nbsp;m-by-n matrix of binary (logical) zeros // FALSE&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/829168951509458948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2011/12/how-to-use-binary-variable-true-false.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/829168951509458948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/829168951509458948'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2011/12/how-to-use-binary-variable-true-false.html' title='How to use binary variable/ TRUE FALSE in MATLAB?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-1949308492105242204</id><published>2011-12-14T07:42:00.000-08:00</published><updated>2012-02-02T05:39:35.032-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MATLAB"/><category scheme="http://www.blogger.com/atom/ns#" term="Student&#39;s t-distribution"/><category scheme="http://www.blogger.com/atom/ns#" term="t-distribution"/><category scheme="http://www.blogger.com/atom/ns#" term="two tailed P value"/><title type='text'>In MATLAB: find two tailed P value of t-distribution (Student&#39;s t-distribution)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Problem:&lt;br /&gt;
-----------&lt;br /&gt;
Given the t-ratio and the degrees of freedom(dof), find two tailed P value of t-distribution (Student&#39;s t-distribution)&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
---------&lt;br /&gt;
Using the &lt;a href=&quot;http://www.spatial-econometrics.com/&quot;&gt;econome&lt;/a&gt;&lt;a href=&quot;http://www.spatial-econometrics.com/&quot;&gt;trics &lt;/a&gt;toolbox here is an example where t ratio = 2.2000 and degree of freedom= 5 ; The computed two tailed P Value is 0.0791&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;title&gt;tdis_prb&lt;/title&gt;&lt;link href=&quot;http://purl.org/dc/elements/1.1/&quot; rel=&quot;schema.DC&quot;&gt;&lt;/link&gt;&lt;style type=&quot;text/css&quot;&gt;
body {
  background-color: white;
  margin:10px;
}

h1 {
  color: #990000; 
  font-size: x-large;
}

h2 {
  color: #990000;
  font-size: medium;
}

/* Make the text shrink to fit narrow windows, but not stretch too far in 
wide windows. */ 
p,h1,h2,div.content div {
  max-width: 600px;
  /* Hack for IE6 */
  width: auto !important; width: 600px;
}

pre.codeinput {
  background: #EEEEEE;
  padding: 10px;
}
@media print {
  pre.codeinput {word-wrap:break-word; width:100%;}
} 

span.keyword {color: #0000FF}
span.comment {color: #228B22}
span.string {color: #A020F0}
span.untermstring {color: #B20000}
span.syscmd {color: #B28C00}

pre.codeoutput {
  color: #666666;
  padding: 10px;
}

pre.error {
  color: red;
}

p.footer {
  text-align: right;
  font-size: xx-small;
  font-weight: lighter;
  font-style: italic;
  color: gray;
}

  
&lt;/style&gt;&lt;br /&gt;
&lt;div class=&quot;content&quot;&gt;
&lt;pre class=&quot;codeinput&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;function&lt;/span&gt; y = tdis_prb(x,n)
&lt;span class=&quot;comment&quot;&gt;% PURPOSE: calculates t-probabilities for elements in x-vector&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;%---------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% USAGE: y = tdis_prb(x,n)&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% where: x = vector containing computed t-values&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;%        n = degrees of freedom parameter&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;%---------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% RETURNS:&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;%        y = a vector of marginal probability levels&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% --------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% SEE ALSO: fdis_prb(), chis_prb&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;%---------------------------------------------------&lt;/span&gt;

&lt;span class=&quot;comment&quot;&gt;% written by:&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% James P. LeSage, Dept of Economics&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% University of Toledo&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% 2801 W. Bancroft St,&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% Toledo, OH 43606&lt;/span&gt;
&lt;span class=&quot;comment&quot;&gt;% jpl@jpl.econ.utoledo.edu&lt;/span&gt;


&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt; nargin ~= 2; error(&lt;span class=&quot;string&quot;&gt;&#39;Wrong # of arguments to tdis_prb&#39;&lt;/span&gt;); &lt;span class=&quot;keyword&quot;&gt;end&lt;/span&gt;;
&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt; n &amp;lt;=0; error(&lt;span class=&quot;string&quot;&gt;&#39;dof is negative or zero in tdis_prb&#39;&lt;/span&gt;); &lt;span class=&quot;keyword&quot;&gt;end&lt;/span&gt;;

x2 = n./(n+x.^2);
one = find(x2 &amp;gt;= 1);
&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt; length(one) &amp;gt; 0
    x2(one,1) = 1-1e-12;
&lt;span class=&quot;keyword&quot;&gt;end&lt;/span&gt;;
zip = find(x2 &amp;lt;= 0);
&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt; length(zip) &amp;gt; 0
    x2(zip,1) = 1e-12;
&lt;span class=&quot;keyword&quot;&gt;end&lt;/span&gt;;

tmp = 1.0 - 0.5*betainc(x2,0.5*n,0.5);
y = 2*(1-tmp);
x
n
&lt;span class=&quot;keyword&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;pre class=&quot;codeoutput&quot;&gt;x =

    2.2000


n =

     5


ans =

    0.0791

&lt;/pre&gt;
&lt;div class=&quot;footer&quot;&gt;
&lt;br /&gt;
Published with MATLAB® 7.13&lt;/div&gt;
&lt;/div&gt;
Exercise:&lt;br /&gt;
-----------&lt;br /&gt;
Using this function (&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #eeeeee; font-family: monospace; white-space: pre;&quot;&gt;tdis_prb&lt;/span&gt;) plot results for [-4:0.05:4] for 10 degrees of freedom.&amp;nbsp;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/1949308492105242204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2011/12/problem-given-t-ratio-and-degrees-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/1949308492105242204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/1949308492105242204'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2011/12/problem-given-t-ratio-and-degrees-of.html' title='In MATLAB: find two tailed P value of t-distribution (Student&#39;s t-distribution)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8302916381344297037.post-2592656292522654145</id><published>2011-12-13T09:49:00.000-08:00</published><updated>2011-12-13T09:49:26.663-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MATLAB"/><category scheme="http://www.blogger.com/atom/ns#" term="Undo SORT"/><title type='text'>In MATLAB: Sort an Array and then Undo that sort</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
PROBLEM:&lt;div&gt;
--------------&lt;/div&gt;
&lt;div&gt;
Imagine I have an array to be sorted and after I sort it I want to UNDO that sort so that the array came back to the initial condition.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
How?&lt;/div&gt;
&lt;div&gt;
---------&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;A=[10 9 7 4 5 7 5 3 ];&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;gt;&amp;gt; [SORTED_A,IX]=sort(A)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
SORTED_A =&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp;10&lt;/div&gt;
&lt;div&gt;
IX =&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;8 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; 1&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;gt;&amp;gt; UNSORTED=1:length(A)&lt;/div&gt;
&lt;div&gt;
UNSORTED =&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 8&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;gt;&amp;gt; NEW_INDEX(IX)=UNSORTED&lt;/div&gt;
&lt;div&gt;
NEW_INDEX =&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;8 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; 3 &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 1&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;gt;&amp;gt; NEW_A=SORTED_A(NEW_INDEX)&lt;/div&gt;
&lt;div&gt;
NEW_A =&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; 9 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp; 3&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;gt;&amp;gt; isequal(A,NEW_A)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
ans =&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnyourselfmatlab.blogspot.com/feeds/2592656292522654145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2011/12/in-matlab-sort-array-and-then-undo-that.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/2592656292522654145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8302916381344297037/posts/default/2592656292522654145'/><link rel='alternate' type='text/html' href='http://learnyourselfmatlab.blogspot.com/2011/12/in-matlab-sort-array-and-then-undo-that.html' title='In MATLAB: Sort an Array and then Undo that sort'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>