<?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-1728010849620533535</id><updated>2024-08-29T15:22:15.090-07:00</updated><title type='text'>J&#39;s programming blog</title><subtitle type='html'>This is where I write about things that I see, hear, learn, and think of.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.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>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-7851300838541654662</id><published>2012-03-30T20:56:00.002-07:00</published><updated>2012-03-30T20:56:53.766-07:00</updated><title type='text'>A tip to speed up your MATALB script</title><content type='html'>A few days ago, my friend sent me a MATLAB script asking for help.&lt;br /&gt;
The script had a bug, but he said if the bug is fixed it would take a few hours to run.&lt;br /&gt;
I fixed the bug and made some changes, then it took less than 20 seconds to run.&lt;br /&gt;
How could this be?&lt;br /&gt;
&lt;br /&gt;
Here&#39;s a small tip that can make a huge change in calculation time.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s say we are calculating something and updating an array. For example, you start with an array with size (10,1). During the for-loop or while-loop you&#39;re adding one more value to it.&lt;br /&gt;
So the array size becomes (11,1). This is what happens behind the scene.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXsf6ri0tGozy3w9c9Gus8WSzZkl89Si55qE7sX-DJbl0aiVMphML19dz5W_9jCb0EKvooSXAbeMWHNkTfH6KSwJ2Ln8VNeGeHBFPaY2-7cEvP9vGtxzgErcu4pm_GsJTO0rzIo9LjJU4/s1600/1more.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;287&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXsf6ri0tGozy3w9c9Gus8WSzZkl89Si55qE7sX-DJbl0aiVMphML19dz5W_9jCb0EKvooSXAbeMWHNkTfH6KSwJ2Ln8VNeGeHBFPaY2-7cEvP9vGtxzgErcu4pm_GsJTO0rzIo9LjJU4/s400/1more.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Click on the picture to enlarge.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;When you ask for one more space that&#39;s not ready to use yet, MATLAB has to get that extra space from Windows. (follow the &lt;span style=&quot;color: orange;&quot;&gt;orange arrows&lt;/span&gt;). Windows wants to keep elements of an array together, physically. So it goes to the memory to see if there&#39;s a room or one more element.&lt;br /&gt;
&lt;br /&gt;
If there is, it gives ok sign to MATLAB (still following the &lt;span style=&quot;color: orange;&quot;&gt;orange arrows&lt;/span&gt;), and MATLAB can use it.&lt;br /&gt;
If there isn&#39;t, Windows has to find a space somewhere else on the memory (not we&#39;re following the &lt;span style=&quot;color: red;&quot;&gt;red arrows&lt;/span&gt;). Once that relocation is done, it gives ok sign to MATLAB.&lt;br /&gt;
&lt;br /&gt;
This can be avoided by declaring an empty array before you use it. Like, A=zeros(11,1). Now the space is available and initialized with zeros. When your MATLAB script wants to use that 11th space, it can just go there and use it (&lt;span style=&quot;color: #0b5394;&quot;&gt;blue arrows&lt;/span&gt;).&lt;br /&gt;
&lt;br /&gt;
The yellow and red arrows shown above takes much longer time compared to the blue route, and becomes really noticeable when you deal with large array size.&lt;br /&gt;
&lt;br /&gt;
If your array is expanding from (10,1) to (11,1), you won&#39;t notice a difference, but if you&#39;re expanding from (100000,1) to (100001,1) then (100002,1) and so on, you may end up spending hours instead of minutes.&lt;br /&gt;
&lt;br /&gt;
So guesstimate the array size you&#39;ll need and initialize it.&lt;br /&gt;
MATLAB is very forgiving in many aspects, but that can slow down your code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/7851300838541654662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/tip-to-speed-up-your-matalb-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/7851300838541654662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/7851300838541654662'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/tip-to-speed-up-your-matalb-script.html' title='A tip to speed up your MATALB script'/><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/AVvXsEjXsf6ri0tGozy3w9c9Gus8WSzZkl89Si55qE7sX-DJbl0aiVMphML19dz5W_9jCb0EKvooSXAbeMWHNkTfH6KSwJ2Ln8VNeGeHBFPaY2-7cEvP9vGtxzgErcu4pm_GsJTO0rzIo9LjJU4/s72-c/1more.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-1222000856492543824</id><published>2012-03-25T10:47:00.002-07:00</published><updated>2012-03-25T10:47:45.063-07:00</updated><title type='text'>GUI in MATLAB 8</title><content type='html'>Wow, it&#39;s been 2 weeks since I wrote something for this blog.&lt;br /&gt;
&lt;br /&gt;
I think this will be the last part of GUI in MATLAB series unless I remember something I missed.&lt;br /&gt;
I hope the stuff I covered so far have helped whoever out there in some way.&lt;br /&gt;
If not, oh well.&lt;br /&gt;
&lt;br /&gt;
Last time I showed you how to save data to the on-screen objects, like a monitor screen, a window you just opened, axes, or plots. (Ok, I just showed how to save things on a monitor screen, but the idea is the same for others as well)&lt;br /&gt;
&lt;br /&gt;
Today, I&#39;ll demonstrate how to save data in a storage and retrieve it later.&lt;br /&gt;
As usual, the source code is at the bottom of this posting.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start with opening a figure and placing things on it.&lt;br /&gt;
Then assign what the buttons should do when pressed.&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/AVvXsEjes6aTEOFqSfy5UtYBvyCWHoRix33uiqvw3wzwJsyMn4ruYDPuLroyN-DMkbZeHX_HdWCFF24TJFN2WAHhF8dMDwkduAIjtsJhLrq5nzPFku_xxV09eMmfVzSSNarcWMrIAn6lXkLCmds/s1600/STORAGE1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;238&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjes6aTEOFqSfy5UtYBvyCWHoRix33uiqvw3wzwJsyMn4ruYDPuLroyN-DMkbZeHX_HdWCFF24TJFN2WAHhF8dMDwkduAIjtsJhLrq5nzPFku_xxV09eMmfVzSSNarcWMrIAn6lXkLCmds/s400/STORAGE1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&amp;nbsp;As you see here, the last three buttons are not doing anything. I just made them because I didn&#39;t like to have too much empty space on a corner.&lt;br /&gt;
&lt;br /&gt;
Now, let&#39;s write a local function for the first button. This button is supposed to open a data file and import the data, but since I don&#39;t have any sample data, I made series or random numbers. Then save it in storage spaces called, x, y1, y2, y3, and y4.&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/AVvXsEhvpdPmQFf3Wq-VQGFCWPQqmSPHHUgdGv2-ELbt-TmO3Lkw9Q6PIpX-vZh9m7LMUgW0xZbxboI-_DDnIoCHlRgP6aINUr9IOxZl1nqwsc0Ix_bOFscS0BVZ_q2QZbHycj8O9c8IDDPWluI/s1600/STORAGE2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvpdPmQFf3Wq-VQGFCWPQqmSPHHUgdGv2-ELbt-TmO3Lkw9Q6PIpX-vZh9m7LMUgW0xZbxboI-_DDnIoCHlRgP6aINUr9IOxZl1nqwsc0Ix_bOFscS0BVZ_q2QZbHycj8O9c8IDDPWluI/s400/STORAGE2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
It&#39;s time to write instructions for the rest of buttons. When the plot buttons are pressed, it gets data from the storage and plot them on the axes. Here you see I did not specify which axes to put the plots on because there&#39;s only one axes. Someday, if you work with more than one axes, be sure to specify it along with plot.&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/AVvXsEiza8QTKF1JBkk7kvgBWM62kGES853y9hiHIQ6NHAJgaNwjkCIyX86luDRxWNohLFrv-2kYh5URf9xhjIpgQ7ttnRDBQD8eLk9E4wa-Mvi7k9d2Baf-YI9TfvcmGPg9xDjk6vrq7IOKEqI/s1600/STORAGE3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiza8QTKF1JBkk7kvgBWM62kGES853y9hiHIQ6NHAJgaNwjkCIyX86luDRxWNohLFrv-2kYh5URf9xhjIpgQ7ttnRDBQD8eLk9E4wa-Mvi7k9d2Baf-YI9TfvcmGPg9xDjk6vrq7IOKEqI/s400/STORAGE3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;The end result looks like this. Start with &quot;Get Data&quot; button and play with the rest of plotting buttons.&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/AVvXsEh7R8fXt1vdjSozX40rQDmAK_D-AKUCW3zdfRCojj5Tlj-_Iq7NXiADrgmI36Q3YgifL-UwKXc0iejxyCvsyYdsszWGmwRw-sUnaDhQ2E-geN7F1c0ucZjvkfCEzRi3v_ETof1Rf3ADn7g/s1600/STORAGE4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;301&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7R8fXt1vdjSozX40rQDmAK_D-AKUCW3zdfRCojj5Tlj-_Iq7NXiADrgmI36Q3YgifL-UwKXc0iejxyCvsyYdsszWGmwRw-sUnaDhQ2E-geN7F1c0ucZjvkfCEzRi3v_ETof1Rf3ADn7g/s400/STORAGE4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now you see there isn&#39;t much too GUI in MATLAB. It&#39;s just a bunch of somewhat unfamiliar keywords, and the concept is fairly straight forward.&lt;br /&gt;
&lt;br /&gt;
Well, of course there is much more to the GUI in MATLAB but I think this is a good place to start with it.&lt;br /&gt;
&lt;br /&gt;
One more thing. Compared to the text-only MATLAB codes, you see that the GUI takes more work time and effort to write a code. One time I heard someone saying, &quot;To make a program easy to use, the programmer should put more time and effort to write it.&quot; He was talking about GUI.&lt;br /&gt;
But the upside of this is that once you write it, you won&#39;t have to tell others how to use it much. How convenient!!&lt;br /&gt;
&lt;br /&gt;
I&#39;ll add more to the GUI in MATLAB if any of you reading this have a question aspired by a burning curiosity. But until then, this is it.&lt;br /&gt;
Have fun with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: yellow;&quot;&gt;
Source code:&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% I&#39;m calling this STORAGE because it&#39;s about a hidden storage.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;function STORAGE&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;F1 = figure(&#39;Position&#39;,[100 200 700 500],&#39;toolbar&#39;,&#39;none&#39;,&#39;menubar&#39;,&#39;none&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;A1 = axes(&#39;Parent&#39;,F1,&#39;unit&#39;,&#39;pixel&#39;,&#39;position&#39;,[50 50 500 440]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B1 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 460 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B2 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 420 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B3 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 380 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B4 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 340 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B5 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 300 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B6 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 260 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B7 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 220 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B8 = uicontrol(&#39;Parent&#39;,F1,&#39;style&#39;,&#39;pushbutton&#39;,&#39;position&#39;,[560 180 130 30]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B1,&#39;string&#39;,&#39;Get Data&#39;,&#39;callback&#39;,{@LOCALGetData F1})&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B2,&#39;string&#39;,&#39;Plot 1st Data&#39;,&#39;callback&#39;,{@LOCALPlot F1 1})&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B3,&#39;string&#39;,&#39;Plot 2nd Data&#39;,&#39;callback&#39;,{@LOCALPlot F1 2})&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B4,&#39;string&#39;,&#39;Plot 3rd Data&#39;,&#39;callback&#39;,{@LOCALPlot F1 3})&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B5,&#39;string&#39;,&#39;Plot 4th Data&#39;,&#39;callback&#39;,{@LOCALPlot F1 4})&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B6,&#39;string&#39;,&#39;This doesn&#39;&#39;t do anything&#39;)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B7,&#39;string&#39;,&#39;This doesn&#39;&#39;t do anything&#39;)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;set(B8,&#39;string&#39;,&#39;This doesn&#39;&#39;t do anything&#39;)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;function LOCALGetData(varargin)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Since I don&#39;t have data file, I&#39;ll just generate something random.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;F_Handle = varargin{3};&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;x = 1:10;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y1=rand(1,10);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y2=rand(1,10);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y3=rand(1,10);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y4=rand(1,10);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;setappdata(F_Handle,&#39;x&#39;,x)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;setappdata(F_Handle,&#39;y1&#39;,y1)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;setappdata(F_Handle,&#39;y2&#39;,y2)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;setappdata(F_Handle,&#39;y3&#39;,y3)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;setappdata(F_Handle,&#39;y4&#39;,y4)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;function LOCALPlot(varargin)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;F_Handle = varargin{3};&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;PlotNum = varargin{4};&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;x = getappdata(F_Handle,&#39;x&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y1= getappdata(F_Handle,&#39;y1&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y2= getappdata(F_Handle,&#39;y2&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y3= getappdata(F_Handle,&#39;y3&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y4= getappdata(F_Handle,&#39;y4&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;if PlotNum == 1&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; plot(x,y1)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;elseif PlotNum == 2&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; plot(x,y2)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;elseif PlotNum == 3&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; plot(x,y3)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;elseif PlotNum == 4&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; plot(x,y4)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;end&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;xlim([1 10])&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ylim([0 1])&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/1222000856492543824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/gui-in-matlab-8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/1222000856492543824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/1222000856492543824'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/gui-in-matlab-8.html' title='GUI in MATLAB 8'/><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/AVvXsEjes6aTEOFqSfy5UtYBvyCWHoRix33uiqvw3wzwJsyMn4ruYDPuLroyN-DMkbZeHX_HdWCFF24TJFN2WAHhF8dMDwkduAIjtsJhLrq5nzPFku_xxV09eMmfVzSSNarcWMrIAn6lXkLCmds/s72-c/STORAGE1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-6392129105753329310</id><published>2012-03-10T16:28:00.001-08:00</published><updated>2012-03-10T16:28:50.963-08:00</updated><title type='text'>GUI in MATLAB 7</title><content type='html'>I&#39;ve been super busy with things, and haven&#39;t posted anything new for some time.&lt;br /&gt;
I&#39;m back now. &lt;br /&gt;
&lt;br /&gt;
Today&#39;s portion is about saving data (whatever type it is) in a hidden storage of a figure.&lt;br /&gt;
Why do we need this? Well, let&#39;s think about a hypothetical situation where you&#39;re dealing with a data of some kind.&lt;br /&gt;
&lt;br /&gt;
You make a uicontrol button that opens up and load data from an excel file. This is done by a local function.&lt;br /&gt;
Then, you need to send it to the main function, so the main function can play with the data some place else.&lt;br /&gt;
The main function can send it to another local function when you press another function, and this local function will plot it on an axes or filter it out using whatever tools it has.&lt;br /&gt;
&lt;br /&gt;
Of course you can think of sending your data out and returning it back to main function from the local function. However, this can easily make your code horribly complicated (well, at least that&#39;s what I experienced).&lt;br /&gt;
&lt;br /&gt;
So, what if we save all the common data in one place, and different local functions can go grab it whenever they need it? There&#39;s no need to pass data from one location to another in the function, because the &quot;storage space&quot; is there holding it.&lt;br /&gt;
Ah~.&lt;br /&gt;
&lt;br /&gt;
That&#39;s what we&#39;re doing this time and next.&lt;br /&gt;
I tried to put it in one posting, but I figured it&#39;s better to split into two.&lt;br /&gt;
&lt;br /&gt;
So, let&#39;s start.&lt;br /&gt;
&lt;br /&gt;
Before using the storage, you need to know where it is.&lt;br /&gt;
The answer is: anything you see on the screen. This storage is hidden, so you won&#39;t see it unless you go dig it out.&lt;br /&gt;
Anything you see on the screen... well, almost anything.&lt;br /&gt;
That includes your monitor screen, the figure window you just opened, the axes you just placed on that figure, the plot you just drew. They all have their own storage spaces.&lt;br /&gt;
&lt;br /&gt;
Then how do you get in there and put things in it?&lt;br /&gt;
The magic key word is &quot;setappdata&quot; and &quot;getappdata&quot;.&lt;br /&gt;
As you guessed it, &quot;setappdata&quot; put things(matrix, array, strings, etc) in a specific place.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s try something simple now.&lt;br /&gt;
When it comes to MATLAB, object handle &quot;0&quot; is reserved for the entire monitor space. &lt;br /&gt;
&lt;br /&gt;
Let&#39;s make a test matrix, x.&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/AVvXsEjLsxHVntqRq-buCS3m6osUHdIBnh4x9x0DU0lV8WQRNjllIphaZGnNg5aStfzwM9QDToQXE__l6dpY4frjMrcRB2uawTIhPvGXNRMDbvGFEvEcm2LVhrGNOjiuck8tIDMNHxCb49e7oFk/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;87&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLsxHVntqRq-buCS3m6osUHdIBnh4x9x0DU0lV8WQRNjllIphaZGnNg5aStfzwM9QDToQXE__l6dpY4frjMrcRB2uawTIhPvGXNRMDbvGFEvEcm2LVhrGNOjiuck8tIDMNHxCb49e7oFk/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now save it to the monitor screen&#39;s storage.&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/AVvXsEgyFwKG9s2WMqqeHXexpSieA_Wp1pd56nJeKV9AyioZisAoBhODuzo5MZs6aeqdhSGGQVzs0bXSO8Shh4ObG47kCd-VqIKsrrCX5J9yRsVeLIbZTv2gInXLiO1zNmC_3JRHf_ZQEaktVpg/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;252&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyFwKG9s2WMqqeHXexpSieA_Wp1pd56nJeKV9AyioZisAoBhODuzo5MZs6aeqdhSGGQVzs0bXSO8Shh4ObG47kCd-VqIKsrrCX5J9yRsVeLIbZTv2gInXLiO1zNmC_3JRHf_ZQEaktVpg/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Go back to the storage and bring it out.&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/AVvXsEgSKKdVXR2vFgSYvs1kV_vRb3ZcdgznJUTpT21IGWZJJEouu10Gvfrh5Hv3ANXKWo3VQZ_cc-A4YDxibf6lgvsc51YLR5ajVzvnh9Jsd31rQWUvu8YTYS7w_sAfEgWSiDI7BGoD-ulMpdw/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;262&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSKKdVXR2vFgSYvs1kV_vRb3ZcdgznJUTpT21IGWZJJEouu10Gvfrh5Hv3ANXKWo3VQZ_cc-A4YDxibf6lgvsc51YLR5ajVzvnh9Jsd31rQWUvu8YTYS7w_sAfEgWSiDI7BGoD-ulMpdw/s400/3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
That&#39;s not bad.&lt;br /&gt;
I&#39;ll show you how to use this in the GUI programming next time.</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/6392129105753329310/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/gui-in-matlab-7.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/6392129105753329310'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/6392129105753329310'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/gui-in-matlab-7.html' title='GUI in MATLAB 7'/><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/AVvXsEjLsxHVntqRq-buCS3m6osUHdIBnh4x9x0DU0lV8WQRNjllIphaZGnNg5aStfzwM9QDToQXE__l6dpY4frjMrcRB2uawTIhPvGXNRMDbvGFEvEcm2LVhrGNOjiuck8tIDMNHxCb49e7oFk/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-3999136443867589322</id><published>2012-03-01T18:02:00.001-08:00</published><updated>2012-03-01T19:49:39.838-08:00</updated><title type='text'>GUI in MATLAB 6</title><content type='html'>We tasted what uicontrol is like last time.&lt;br /&gt;
Let&#39;s see what else is available and what more we can do with it.&lt;br /&gt;
&lt;br /&gt;
There are 10 different types of uicontrol - pushbutton, togglebutton, ...&lt;br /&gt;
I&#39;ll show you 6 types of uicontrol that I use most.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start with the usual - making windows without a menubar or a toolbar, and 6 uicontrols with different styles.&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/AVvXsEhc5uJKhyphenhyphenNmqryqvCE4hxl8IxrYN1Cb55ciocmmYSq6AgjF_RuclXzl4mWNY3jQeG6cc23HKYjoiRwBo7d5PIjG1N38oOi5BGCyCyXalxxz3zuBhItY0s3Qt9JgoNRzkpGDfc8lsyFl6o0/s1600/GUI1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc5uJKhyphenhyphenNmqryqvCE4hxl8IxrYN1Cb55ciocmmYSq6AgjF_RuclXzl4mWNY3jQeG6cc23HKYjoiRwBo7d5PIjG1N38oOi5BGCyCyXalxxz3zuBhItY0s3Qt9JgoNRzkpGDfc8lsyFl6o0/s400/GUI1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Then, change the displayed strings using set(handle, &#39;string&#39;,...).&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Also, add a local functions that will do something when the uicontrol is changed in some way&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/AVvXsEi2xL9nTl7ZMF-ZttwTJ6UA4HIHTcb3aLi1z2KIM5C5dug5aMtB28ySygdoFO0IeKRc-NqV_5Mg9n0-FgHVs0rSbpng4m9_ixZkKVf0VGYMH7B3zIN3X9fHfNF99iQaYyZB5Px_dZ_AlSo/s1600/GUI2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;168&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2xL9nTl7ZMF-ZttwTJ6UA4HIHTcb3aLi1z2KIM5C5dug5aMtB28ySygdoFO0IeKRc-NqV_5Mg9n0-FgHVs0rSbpng4m9_ixZkKVf0VGYMH7B3zIN3X9fHfNF99iQaYyZB5Px_dZ_AlSo/s400/GUI2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
These two are the local functions for the uicontrols.&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/AVvXsEj3XhhoejQCLVQRYHa5Sbvyhi58Vg2TiHs6POp2CCX65avFnM6qVRVeAH1wWFN_qKwEACDNicnX91uGkHQxVovkIut5n-ycnsWd_mOqxD5jxaFrKu2VPTVCGc_QSeM2aiPHoWnbHV0lfbw/s1600/GUI3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;121&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3XhhoejQCLVQRYHa5Sbvyhi58Vg2TiHs6POp2CCX65avFnM6qVRVeAH1wWFN_qKwEACDNicnX91uGkHQxVovkIut5n-ycnsWd_mOqxD5jxaFrKu2VPTVCGc_QSeM2aiPHoWnbHV0lfbw/s400/GUI3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Run this, and this figure with things appear.&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/AVvXsEj_g3rwKoK_wmIvHcyIHzHZUoummFPaBp_o1OtiDfPvqZ-y1t8I57QOj-TnVKC5BhNARFV-sSYDS6wYD7dySjbZmQOe64-UWEMZj8wp3k0o9_SNf4RJcIG_MHKVG6Cr75bPqILNy77jMv4/s1600/GUI4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_g3rwKoK_wmIvHcyIHzHZUoummFPaBp_o1OtiDfPvqZ-y1t8I57QOj-TnVKC5BhNARFV-sSYDS6wYD7dySjbZmQOe64-UWEMZj8wp3k0o9_SNf4RJcIG_MHKVG6Cr75bPqILNy77jMv4/s400/GUI4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now when you click the uicontrol or make changes on the uicontrol, a message will appear on the command window.&lt;br /&gt;
These are how to use them.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;Pushbutton&lt;/span&gt;: click it&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;Checkbox&lt;/span&gt;: check or uncheck the box&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;Edit box&lt;/span&gt;: type something in and press enter&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;Text box&lt;/span&gt;: sorry. it&#39;s for display only. So, even though we have callback feature set up for it, it won&#39;t do anything.&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;Listbox&lt;/span&gt;: click different items&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;Popupmenu&lt;/span&gt;: use the drop down triangle on the right and click different entries.&lt;br /&gt;
&lt;br /&gt;
There are a few things to note. The listbox and popupmenu have different local function set up than the rest of uicontrols. Do you wonder why? Change the callback to user 1st local function and see what happens when you play with listbox or popupmenu.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next time I&#39;ll show you how to save information on the hidden storage of the figure.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: yellow;&quot;&gt;
This is the source code for this exercise.&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;function GUI2&lt;br /&gt;% Start with the usual.&lt;br /&gt;% Open a window, get rid of the menubar and toolbar.&lt;br /&gt;F1 = figure(&#39;Position&#39;,[100 300 700 250],&#39;menubar&#39;,&#39;none&#39;,&#39;toolbar&#39;,&#39;none&#39;);&lt;br /&gt;&lt;br /&gt;% Add differnt kinds of uicontols. Handles are S#. S for style&lt;br /&gt;S1 = uicontrol(&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[10 210 680 30],...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;style&#39;,&#39;pushbutton&#39;);&lt;br /&gt;S2 = uicontrol(&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[10 170 680 30],...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;style&#39;,&#39;checkbox&#39;);&lt;br /&gt;S3 = uicontrol(&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[10 130 680 30],...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;style&#39;,&#39;edit&#39;);&lt;br /&gt;S4 = uicontrol(&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[10 90&amp;nbsp; 680 30],...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;style&#39;,&#39;text&#39;);&lt;br /&gt;S5 = uicontrol(&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[10 50&amp;nbsp; 680 30],...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;style&#39;,&#39;listbox&#39;);&lt;br /&gt;S6 = uicontrol(&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[10 10&amp;nbsp; 680 30],...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;style&#39;,&#39;popupmenu&#39;);&lt;br /&gt;&lt;br /&gt;% Set strings on the uicontrol&lt;br /&gt;set(S1, &#39;string&#39;,&#39;This is pushbutton&#39;)&lt;br /&gt;set(S2, &#39;string&#39;,&#39;This is checkbox&#39;)&lt;br /&gt;set(S3, &#39;string&#39;,&#39;This is edit box&#39;)&lt;br /&gt;set(S4, &#39;string&#39;,&#39;This is text box&#39;)&lt;br /&gt;set(S5, &#39;string&#39;,&#39;This is listbox-line1 | line2 | line3 | line4&#39;)&lt;br /&gt;set(S6, &#39;string&#39;,&#39;This is popupmenu-line1 | line2 | line3 | line4&#39;)&lt;br /&gt;&lt;br /&gt;% Configure what&#39;s going to happen if you click, change, or something.&lt;br /&gt;set(S1, &#39;callback&#39;,{@LOCALReaction})&lt;br /&gt;set(S2, &#39;callback&#39;,{@LOCALReaction})&lt;br /&gt;set(S3, &#39;callback&#39;,{@LOCALReaction})&lt;br /&gt;set(S4, &#39;callback&#39;,{@LOCALReaction})&lt;br /&gt;set(S5, &#39;callback&#39;,{@LOCALReaction2})&lt;br /&gt;set(S6, &#39;callback&#39;,{@LOCALReaction2})&lt;br /&gt;&lt;br /&gt;function LOCALReaction(varargin)&lt;br /&gt;Handle = varargin{1};&lt;br /&gt;disp([&#39;You&#39;&#39;re playing with &#39;,get(Handle,&#39;Style&#39;),&#39;, and the contents are:&#39;])&lt;br /&gt;disp(get(Handle,&#39;string&#39;))&lt;br /&gt;disp(&#39; &#39;)&lt;br /&gt;&lt;br /&gt;function LOCALReaction2(varargin)&lt;br /&gt;Handle = varargin{1};&lt;br /&gt;disp([&#39;You&#39;&#39;re playing with &#39;,get(Handle,&#39;Style&#39;),&#39;, and the value is:&#39;])&lt;br /&gt;disp(get(Handle,&#39;value&#39;))&lt;br /&gt;disp(&#39; &#39;)&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/3999136443867589322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/gui-in-matlab-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/3999136443867589322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/3999136443867589322'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/03/gui-in-matlab-6.html' title='GUI in MATLAB 6'/><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/AVvXsEhc5uJKhyphenhyphenNmqryqvCE4hxl8IxrYN1Cb55ciocmmYSq6AgjF_RuclXzl4mWNY3jQeG6cc23HKYjoiRwBo7d5PIjG1N38oOi5BGCyCyXalxxz3zuBhItY0s3Qt9JgoNRzkpGDfc8lsyFl6o0/s72-c/GUI1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-2842484230509531623</id><published>2012-02-26T19:30:00.000-08:00</published><updated>2012-02-26T19:30:52.709-08:00</updated><title type='text'>GUI in MATLAB 5</title><content type='html'>Today&#39;s portion may look like a big jump from last time, but most of it is same as the last post.&lt;br /&gt;
If you&#39;ve been wondering what this figure handles, axes handles, etc. were for, today is the day you&#39;ll see what they can do.&lt;br /&gt;
&lt;br /&gt;
For this post I wrote a short function. This website doesn&#39;t let me attach the file directly, so I copy-pasted the code at the bottom of this post.&lt;br /&gt;
&lt;br /&gt;
So, here we go.&lt;br /&gt;
&lt;br /&gt;
First it starts with declaring function. Today&#39;s portion won&#39;t work as a script m file. It needs to be a function, because it&#39;s housing another LOCAL function inside.&lt;br /&gt;
Let&#39;s call the main function GUI. What a name.&lt;br /&gt;
Then, the usual stuff follows.&lt;br /&gt;
Make x-array, 2 y-arrays, and open a figure, put axes on, make 2 plots with different color, and limit the axis.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioJmLRqUjqWYy1npRw-IhNWV7VWQ_Lea_yE4xsOFv455ajJ-YB-IIP1BKEqAo8lAAdyyGoPGhn43we7Iv55e0YqZuM0Z6ougBlwDVJQCKziQzbog0mSme_eLjMzIZny1Pk5Nmqex4Ckk0/s1600/GUI1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;216&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioJmLRqUjqWYy1npRw-IhNWV7VWQ_Lea_yE4xsOFv455ajJ-YB-IIP1BKEqAo8lAAdyyGoPGhn43we7Iv55e0YqZuM0Z6ougBlwDVJQCKziQzbog0mSme_eLjMzIZny1Pk5Nmqex4Ckk0/s400/GUI1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Not so different from last time&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
Ok. Now, add 2 buttons using uicontrol. Yes, that&#39;s right. &quot;uicontrol&quot; is the magic command making buttons (actually it&#39;s more than just a button, but we&#39;ll play with them next time). The idea is same as figures or axes.&lt;br /&gt;
There&#39;s position and background color. I didn&#39;t put &quot;Parent&quot; because we&#39;re dealing with just 1 figure. If you have more than one figure opened, you may want to specify that here.&lt;br /&gt;
Then there&#39;s this new thing. &quot;callback&quot;&lt;br /&gt;
&quot;callback&quot; decides what will happen if the button is activated. In this case it calls a local function (it&#39;s local because the function is sitting in a same file) called &quot;LOCALButton&quot;.&lt;br /&gt;
&lt;br /&gt;
When it calls the &quot;LOCALButton&quot; it sends out the plot handle with it (P1 and P2). We&#39;ll examine &quot;callback&quot; in more detail some other time.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhueVkefXBpcnlFCE2psyPcJxofkK6Kw8NRgSNGtYX3l5ZR1j163NxsAGnnGTfAK6aTrBMoV3jqfw8nLJlnKx1F02T-XijSXyLvnAoonecR6VKQ4WG03jt1wcXNpK2z_9hG7iLRjoUXy80/s1600/GUI2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhueVkefXBpcnlFCE2psyPcJxofkK6Kw8NRgSNGtYX3l5ZR1j163NxsAGnnGTfAK6aTrBMoV3jqfw8nLJlnKx1F02T-XijSXyLvnAoonecR6VKQ4WG03jt1wcXNpK2z_9hG7iLRjoUXy80/s400/GUI2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Oh. It&#39;s uicontrol. That&#39;s the magic word.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
So, when the button is pressed, it calls LOCALButton and send out plot handle to the local function.&lt;br /&gt;
This is what the local function looks like.&lt;br /&gt;
The input is varargin, meaning variable argument input (or something like that). This is used when it&#39;s unclear what kind of input is coming in.&lt;br /&gt;
The varargin coming in is in cell array format. So you need to use {} to retrieve the information.&lt;br /&gt;
If you want to know what else is in there, add &quot;varargin&quot; there (can you guess the first number there?)&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGOFRd9dl4Rx24hyphenhyphenen5EJBz5HDdc7eAEhx8aVQVtnn6tkCUTpeDa1Chp_d0IPC4DIKV1dECNJiEUuHIx_hNqjppYQKJhzRGvp3ZuhXmjbuqs2j_3RE0AUXxKBxfmTX8W1dkjZGuPGsVR0/s1600/GUI3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;205&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGOFRd9dl4Rx24hyphenhyphenen5EJBz5HDdc7eAEhx8aVQVtnn6tkCUTpeDa1Chp_d0IPC4DIKV1dECNJiEUuHIx_hNqjppYQKJhzRGvp3ZuhXmjbuqs2j_3RE0AUXxKBxfmTX8W1dkjZGuPGsVR0/s400/GUI3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;This is the local function LOCALButton&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
So, what this local function does is changing on/off of the plot by changing its visibility.&lt;br /&gt;
Perhaps it was a bit too much for one post, but I had to cover it all to explain it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you&#39;re still confused, don&#39;t worry. I&#39;ll do the similar stuff again with different uicontrol types next time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgJgS8uife0JG9OU4ryrlk_eSG5-QAiYmNqyi6l2dQCghHwQ2kMD94QKTYBFFqpdGCIlquJxWNsM4_Ei3rSVtlPohYgHHOStmPaGIfHWuGShEZirTFfwJPlOdF_Ftu-Eg1YtDnghik284/s1600/GUI4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;245&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgJgS8uife0JG9OU4ryrlk_eSG5-QAiYmNqyi6l2dQCghHwQ2kMD94QKTYBFFqpdGCIlquJxWNsM4_Ei3rSVtlPohYgHHOStmPaGIfHWuGShEZirTFfwJPlOdF_Ftu-Eg1YtDnghik284/s400/GUI4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Which button do you wanna press? Blue or Red?&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: yellow;&quot;&gt;Below is the source code. Select-Copy-Paste-Save as GUI.m&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% GUI Sample&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;function GUI&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;x = 1:10;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; % Generate arbitrary data&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y1= rand(1,10);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;y2= rand(1,10);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Open a window.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;F1 = figure(&#39;Position&#39;,[50 200 700 400],&#39;toolbar&#39;,&#39;none&#39;,&#39;menubar&#39;,&#39;none&#39;);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Put a drawing board on it.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;A1 = axes(&#39;Parent&#39;,F1,&#39;unit&#39;,&#39;pixel&#39;,&#39;Position&#39;,[50 50 400 320]);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Plot the data in different colors&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;P1 = plot(x,y1,&#39;b&#39;,&#39;Parent&#39;,A1);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;hold on&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;P2 = plot(x,y2,&#39;r&#39;,&#39;Parent&#39;,A1);&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;hold off&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;xlim([1 10])&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;ylim([0 1])&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Make buttons. One in blue and the other in red.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% &#39;callback&#39; determined what will happen when the button is pressed.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% In this case it&#39;ll call another function called LOCALButton.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% When it calls the LOCALButton, it&#39;ll send out either P1 or P2.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B1 = uicontrol(&#39;Position&#39;,[500 250 100 100],&#39;BackgroundColor&#39;,[0 0 1],...&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;callback&#39;, {@LOCALButton P1});&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;B2 = uicontrol(&#39;Position&#39;,[500 100 100 100],&#39;BackgroundColor&#39;,[1 0 0],...&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;callback&#39;, {@LOCALButton P2});&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% This is the LOCALButton fuction.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% It&#39;s pretty common to assign varargin for the input when it is unknown&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% what kind of input is coming.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% varargin is in cell array format.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;function LOCALButton(varargin)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Whatever was sent from above, 3rd cell is the input.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% So the plot handle from above is varargin{3}.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;CrntP = varargin{3};&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Here I can&#39;t say, get(CrntP,&#39;visible&#39;) == &#39;on&#39;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% because if it&#39;s &#39;off&#39;, &#39;on&#39;==&#39;off&#39; will give you an error.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;% Try that in the command window.&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;if length(get(CrntP,&#39;visible&#39;)) == 2&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set(CrntP,&#39;visible&#39;,&#39;off&#39;)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;else&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set(CrntP,&#39;visible&#39;,&#39;on&#39;)&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/2842484230509531623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/2842484230509531623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/2842484230509531623'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-5.html' title='GUI in MATLAB 5'/><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/AVvXsEioJmLRqUjqWYy1npRw-IhNWV7VWQ_Lea_yE4xsOFv455ajJ-YB-IIP1BKEqAo8lAAdyyGoPGhn43we7Iv55e0YqZuM0Z6ougBlwDVJQCKziQzbog0mSme_eLjMzIZny1Pk5Nmqex4Ckk0/s72-c/GUI1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-5096151162388602241</id><published>2012-02-23T15:04:00.001-08:00</published><updated>2012-02-23T15:04:53.305-08:00</updated><title type='text'>GUI in MATLAB 4</title><content type='html'>Today we&#39;re making plots.&lt;br /&gt;
To make plots we need x and y data.&lt;br /&gt;
We&#39;re making 2 plots, so here we go.&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/AVvXsEjYxNhlJDYrSvs7pE-LlGixwTEwyqeHyz77_fpfz899VZkdNrUGC8_Z8ZljwLzfZSaD5CAxEcU-sdg-AJvb-E2n-IEar6IEQqQFqKc_ocoWNgKZZVWJoX__o4iNT3x8mbvUclmiRm7NAzc/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;83&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYxNhlJDYrSvs7pE-LlGixwTEwyqeHyz77_fpfz899VZkdNrUGC8_Z8ZljwLzfZSaD5CAxEcU-sdg-AJvb-E2n-IEar6IEQqQFqKc_ocoWNgKZZVWJoX__o4iNT3x8mbvUclmiRm7NAzc/s400/1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Then, open a blank window using &quot;figure&quot;, and put 2 axes on it.&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/AVvXsEg3WObYBYYnNhewldPH2mbvLEgO-yw-yB3wtmbCSlzGJGAvYnwCOkX7sPq2y40nyXMd7V5Uf3LEdEUZOvHGIEFK_Bhi1lK8hQHq31BOtREIIEuAEZZRMBVCA7Im9fvqYQ9DLfLAz5tx1jo/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;109&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3WObYBYYnNhewldPH2mbvLEgO-yw-yB3wtmbCSlzGJGAvYnwCOkX7sPq2y40nyXMd7V5Uf3LEdEUZOvHGIEFK_Bhi1lK8hQHq31BOtREIIEuAEZZRMBVCA7Im9fvqYQ9DLfLAz5tx1jo/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
If you&#39;re not familiar with &quot;axes&quot; this may look a bit odd. You may think &quot;wait. I thought it was axis, not axes&quot;.&lt;br /&gt;
Well, they are different. You can think of it this way.&lt;br /&gt;
The figure you just opened is like a wall. Then you put a white piece of paper so you can draw things on it. This white piece of paper is &quot;axes&quot; The &quot;axes&quot; has x and y &quot;axis&quot;.&lt;br /&gt;
&lt;br /&gt;
Another thing to notice is &quot;Parent&quot; and &quot;units&quot;. I&#39;m not very good with other programming languages, so I don&#39;t know if others have this concept, but this is what people call &quot;Parent&quot; in MATLAB.&lt;br /&gt;
I mentioned that &quot;axes&quot; is like a piece of paper, right? This paper should have a wall to go to. &quot;Parent&quot; tells MATLAB which wall to put it to. This is quite useful when you have more than one of something to work with simultaneously.&lt;br /&gt;
&lt;br /&gt;
If you have 2 figures opened up, you want to put your axes on a correct figure. We&#39;ll see this again when we put plots on the axes.&lt;br /&gt;
&lt;br /&gt;
I set units to be pixel. This is something I didn&#39;t specified in the earlier posting when I was playing with figure. For some reason (unfortunately I don&#39;t know why this is default) the default setting for axes position is normalized value - going from 0 to 1. So you need to change the setting to put your axes on a precise location on the figure.&lt;br /&gt;
&lt;br /&gt;
Now, let&#39;s put plots on the axes we just made. We&#39;re making 2 plots and each axes will take one.&lt;br /&gt;
Try the following. &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/AVvXsEgwyBHm3pWcJ4_eyIfDv2ZqD_rmoZlaSDYGnqAyjYdSuTSjgHYNhZ85SK-8TL50U7-6y3zO3h2pCqkR7-p1GDlxPsJefI21KprKkx8uUZYJjIREWQAoqZXi1MjXHRz1HJ2lYSoRB7-8nyo/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;113&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwyBHm3pWcJ4_eyIfDv2ZqD_rmoZlaSDYGnqAyjYdSuTSjgHYNhZ85SK-8TL50U7-6y3zO3h2pCqkR7-p1GDlxPsJefI21KprKkx8uUZYJjIREWQAoqZXi1MjXHRz1HJ2lYSoRB7-8nyo/s400/3.png&quot; width=&quot;400&quot; /&gt;&amp;nbsp;&lt;/a&gt; &lt;/div&gt;
Here I used axes handle, A1 and A2, as parents to direct which plot goes where.&lt;br /&gt;
&lt;br /&gt;
This is the final result.&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/AVvXsEhmRXHmKvlVVKhs216o1QAu0KxpZLtbvyfsklDySyYifXLvmRHNc0tMvXrf_v6NtA_ckIVkiqZhz4n036WGq98UM160iXBVmKFZjPXmNjh5Yd1eynPU3oIhv3q3UFtkuFAXHrtKDE_n_Io/s1600/4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;357&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmRXHmKvlVVKhs216o1QAu0KxpZLtbvyfsklDySyYifXLvmRHNc0tMvXrf_v6NtA_ckIVkiqZhz4n036WGq98UM160iXBVmKFZjPXmNjh5Yd1eynPU3oIhv3q3UFtkuFAXHrtKDE_n_Io/s400/4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Ha! That was easy.&lt;br /&gt;
&lt;br /&gt;
Now try this.&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/AVvXsEhB5qhuruRyRrimj9uIrqjIKrO19nZphLp0iy-YEQUAf3YRGQFBQbWwNYMVjdmTL8mwnNWap31o75vZZo92qP-Ien2aLy5F_PQX7GRfyFJJ2QvxIfLVY6C-WT0qoo4DFT4Bb0hiyZ0__oY/s1600/5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;50&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB5qhuruRyRrimj9uIrqjIKrO19nZphLp0iy-YEQUAf3YRGQFBQbWwNYMVjdmTL8mwnNWap31o75vZZo92qP-Ien2aLy5F_PQX7GRfyFJJ2QvxIfLVY6C-WT0qoo4DFT4Bb0hiyZ0__oY/s400/5.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now your blue line is thicker.&lt;br /&gt;
&lt;br /&gt;
If you&#39;re wondering what else you can change, you can always try &quot;get(P1)&quot; or &quot;set(P1)&quot;.&lt;br /&gt;
&lt;br /&gt;
Next time I&#39;ll show you how to make buttons for different types of controls.&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/5096151162388602241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/5096151162388602241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/5096151162388602241'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-4.html' title='GUI in MATLAB 4'/><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/AVvXsEjYxNhlJDYrSvs7pE-LlGixwTEwyqeHyz77_fpfz899VZkdNrUGC8_Z8ZljwLzfZSaD5CAxEcU-sdg-AJvb-E2n-IEar6IEQqQFqKc_ocoWNgKZZVWJoX__o4iNT3x8mbvUclmiRm7NAzc/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-414894735238965284</id><published>2012-02-22T18:01:00.000-08:00</published><updated>2012-02-22T19:29:49.222-08:00</updated><title type='text'>GUI in MATLAB 3</title><content type='html'>Last time we played with a figure handle and changed location/size of the window.&lt;br /&gt;
&lt;br /&gt;
Now let&#39;s see what else is there.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start with the usual.&lt;br /&gt;
Then try additional stuff that start with &quot;set(F1,...&quot;&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/AVvXsEjkbyqL9Tpap7vSp-oqQSPoHDJIvd6Llj-eYQ-sdUxqlXdkq4k_tafoZx_xAAH5qgsatngEjh7pZ6wCRBk5KG7ujCdJqYX-vMUyC9sG31C1Pg1kw3kAH2jHSKJ6vHhsyJ8-v8Ad4l26H1s/s1600/F1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;202&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkbyqL9Tpap7vSp-oqQSPoHDJIvd6Llj-eYQ-sdUxqlXdkq4k_tafoZx_xAAH5qgsatngEjh7pZ6wCRBk5KG7ujCdJqYX-vMUyC9sG31C1Pg1kw3kAH2jHSKJ6vHhsyJ8-v8Ad4l26H1s/s400/F1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&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/AVvXsEi8e9pSDHFP_Vx1lSnKZFdyPh7vGx9Lds3moVrFpw5Iv_PLTz2bkLkjCe-E8hShPF0Lzyxq46Bf9TN4rX_Jj2r9kqRcV7yXqL60qqI39KYXW5ef5uRHY-NVPEG3nKUtXl0L-LbVt4f9HTc/s1600/F1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
Now the toolbar and menubar are gone and the figure background changed color to yellow.&lt;br /&gt;
&lt;br /&gt;
What &quot;set&quot; does is changing the &quot;properties&quot; of the object. In the above example, &quot;set&quot; changes the figure&#39;s (it knows which figure it&#39;s changing because you said F1 there.) color, toolbar status, and menubar status.&lt;br /&gt;
Color is in normalized [Red Green Blue] array. [1 1 1] means white and [0 0 0] means black. Of course you can try [0.3 0.5 0.7] for your color. Since it&#39;s normalized [1.5 1 1] won&#39;t work.&lt;br /&gt;
&lt;br /&gt;
That&#39;s right. It&#39;s pretty cool.&lt;br /&gt;
&lt;br /&gt;
Do you wonder what else you can change? There are two ways to check. &quot;set&quot; and &quot;get&quot;.&lt;br /&gt;
&quot;set(F1)&quot; will tell you all the property names, current property values, and other choices for the property values.&lt;br /&gt;
&quot;get(F1)&quot; gives you simply the property names and current values.&lt;br /&gt;
&lt;br /&gt;
That&#39;s enough of playing with figures for now.&lt;br /&gt;
We&#39;ll make some plots next time. After the plot is covered we can put buttons and custom menus on the figure to make it real GUI.</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/414894735238965284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/414894735238965284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/414894735238965284'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-3.html' title='GUI in MATLAB 3'/><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/AVvXsEjkbyqL9Tpap7vSp-oqQSPoHDJIvd6Llj-eYQ-sdUxqlXdkq4k_tafoZx_xAAH5qgsatngEjh7pZ6wCRBk5KG7ujCdJqYX-vMUyC9sG31C1Pg1kw3kAH2jHSKJ6vHhsyJ8-v8Ad4l26H1s/s72-c/F1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-4042986819197767080</id><published>2012-02-21T05:56:00.000-08:00</published><updated>2012-02-21T05:56:38.143-08:00</updated><title type='text'>GUI in MATLAB 2</title><content type='html'>Last time I showed you how to make a figure with a figure handle.&lt;br /&gt;
&lt;br /&gt;
Now let&#39;s open a figure with whatever size you want in whatever position you need.&lt;br /&gt;
&lt;br /&gt;
Type like this&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/AVvXsEg4NWLxNIKm_XF3hHj3-L0pGmeGdhw4-eINwZF38fj-Go7oXP69VLDDiYXygv-s6-h-rbT6oZwFjTrEgJ344v8S9Zj2AJdWHUIp8t3oilg1WRnYFzvTj7FKOjpXEfW0Gkg1ZymxvkZhuKU/s1600/F1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4NWLxNIKm_XF3hHj3-L0pGmeGdhw4-eINwZF38fj-Go7oXP69VLDDiYXygv-s6-h-rbT6oZwFjTrEgJ344v8S9Zj2AJdWHUIp8t3oilg1WRnYFzvTj7FKOjpXEfW0Gkg1ZymxvkZhuKU/s1600/F1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Then this shows up&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/AVvXsEjWl3GBXTgtHffcNQkN7Y4FJm60xsA8O8ditC7GHjnbKj6e4nL3zeh3TfBL3tadh0MMaaCZrNve9oYR_9DYZnnquid4Rurf9EgHz_FHV9KYVBF4fhC9Af7W6xGrTWSytbL98GxOdqs-dMA/s1600/F2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWl3GBXTgtHffcNQkN7Y4FJm60xsA8O8ditC7GHjnbKj6e4nL3zeh3TfBL3tadh0MMaaCZrNve9oYR_9DYZnnquid4Rurf9EgHz_FHV9KYVBF4fhC9Af7W6xGrTWSytbL98GxOdqs-dMA/s640/F2.png&quot; width=&quot;459&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Do you see how that &#39;Position&#39; array puts your figure in a place with size you want? The first two numbers are the &quot;position in terms of # of pixels&quot; of the bottom left corner of the figure in respect to the bottom left corner of your monitor screen.&lt;br /&gt;
The next two numbers are the width and height (in pixels) of the figure. Ah~&lt;br /&gt;
&lt;br /&gt;
Now type this&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/AVvXsEgdrRnt_L3G3yYSyK0cm8oD_7yjAdAk3dwUfZ5tzS_-W0hMIyJIM_L__PbNS6UdB_YMNe5qURszgQlnzw4cuKvzpskDJwpTnEgQ12pN7l-N1ytI0BTMUQXGB5vo6B3gcmIpw5mKSe8j3-M/s1600/F3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdrRnt_L3G3yYSyK0cm8oD_7yjAdAk3dwUfZ5tzS_-W0hMIyJIM_L__PbNS6UdB_YMNe5qURszgQlnzw4cuKvzpskDJwpTnEgQ12pN7l-N1ytI0BTMUQXGB5vo6B3gcmIpw5mKSe8j3-M/s1600/F3.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now the figure moved and changed the size. This is why we&#39;re keeping track of the figure handle instead of just drawing figure. The figure handle, F1, let you make changes and adjustment whenever needed. Using the figure handle you can save important data to the hidden storage for later use.&lt;br /&gt;
&quot;set(something something)&quot; is how you change settings on the object that belongs to the handle.&lt;br /&gt;
Oh~! That&#39;s right.&lt;br /&gt;
&lt;br /&gt;
As I mentioned in the previous post, plots can have handles as well. Like &quot;P1=plot(x,y,&#39;*&#39;)&quot;. Then using this plot handle you can change it&#39;s color, thickness, line shape, etc.&lt;br /&gt;
I&#39;ll show you this in later posts.&lt;br /&gt;
&lt;br /&gt;
Play with it a little more until you get used to the idea of this &#39;Position&#39;.&lt;br /&gt;
Later when we put buttons and text boxes we&#39;ll use &#39;Position&#39; again.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll show you how to change background colors and get rid of menus next time.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/4042986819197767080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/4042986819197767080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/4042986819197767080'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-2.html' title='GUI in MATLAB 2'/><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/AVvXsEg4NWLxNIKm_XF3hHj3-L0pGmeGdhw4-eINwZF38fj-Go7oXP69VLDDiYXygv-s6-h-rbT6oZwFjTrEgJ344v8S9Zj2AJdWHUIp8t3oilg1WRnYFzvTj7FKOjpXEfW0Gkg1ZymxvkZhuKU/s72-c/F1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-7754699092142013558</id><published>2012-02-20T08:31:00.000-08:00</published><updated>2012-02-20T08:31:40.170-08:00</updated><title type='text'>GUI in MATLAB 1</title><content type='html'>I&#39;ve been busy with my other stuff, so there&#39;s not much to talk about C or C++.&lt;br /&gt;
&lt;br /&gt;
So, I&#39;m writing a quick start guide for GUI (graphic user interface) in MATLAB.&lt;br /&gt;
&lt;br /&gt;
I&#39;m assuming you know some about MATALB already. I hope you already know how to generate random x and y and plot them.&lt;br /&gt;
&lt;br /&gt;
Ok, so GUI. Good thing about GUI is that you don&#39;t have to teach or learn how to use a program. Sometimes you write a code and a few months later you forget how to use it. That happens to many people. GUI removes that problem from the scene a lot.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s start with figure and figure-handle.&lt;br /&gt;
&lt;br /&gt;
If you type&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/AVvXsEg7DoOulQwFQZJNLUNM079UtR-5L81DDXqRLDlw9LS8H5sWnewk7Etje3mWv-kCU_Ap0Dd76zr5WjDfzpg16SvVH-rzEMN6yqAfonBcMrhmcODlBPi_cXWBiDoQYjt1exb-lVzRl8EGB9s/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7DoOulQwFQZJNLUNM079UtR-5L81DDXqRLDlw9LS8H5sWnewk7Etje3mWv-kCU_Ap0Dd76zr5WjDfzpg16SvVH-rzEMN6yqAfonBcMrhmcODlBPi_cXWBiDoQYjt1exb-lVzRl8EGB9s/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
A figure shows up&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/AVvXsEiKSLZrJaLnEdIkp13srCzKdO0LhHjg8KE0KIGWiwKhLy1osNQaSQo6a9ED7Tml_-y2N_xPXQvXwxXPL-qZe4_D8O6oHykq0VDh-WRKhwk3BAIuwpOoWiEDPTvikS-sI4fntMOPvtFgl24/s1600/figure1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;285&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKSLZrJaLnEdIkp13srCzKdO0LhHjg8KE0KIGWiwKhLy1osNQaSQo6a9ED7Tml_-y2N_xPXQvXwxXPL-qZe4_D8O6oHykq0VDh-WRKhwk3BAIuwpOoWiEDPTvikS-sI4fntMOPvtFgl24/s320/figure1.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
That was easy.&lt;br /&gt;
Now, if you type&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/AVvXsEjSdgYbPhg8MvkJnKEHx3z0HC_i9ePiO3P2vo8vOHUEiG6-cUGL5XSNw9v8Gp60X16sGdp5NH8VubGvIXnQINmZGE0ASUXQfn3CYNNMHv49P0WV_81H-BRR8rDSBwi1OgzzYNWSOY2T57o/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSdgYbPhg8MvkJnKEHx3z0HC_i9ePiO3P2vo8vOHUEiG6-cUGL5XSNw9v8Gp60X16sGdp5NH8VubGvIXnQINmZGE0ASUXQfn3CYNNMHv49P0WV_81H-BRR8rDSBwi1OgzzYNWSOY2T57o/s1600/2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Same thing happens&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/AVvXsEjJJoFtfHAwSFDv4j-PYyr9cidqZdik-Amfog-gmuhrDcqay5j8_fVMx0i8qVcVpfegSk_-QSnjsVSCX8Zh3P84eY2aMMXO2PJx-F8MtLXVG5DuDMkWnGdlFJMHNgO_2N3UhX_ZZWQEUH8/s1600/figure2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;285&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJJoFtfHAwSFDv4j-PYyr9cidqZdik-Amfog-gmuhrDcqay5j8_fVMx0i8qVcVpfegSk_-QSnjsVSCX8Zh3P84eY2aMMXO2PJx-F8MtLXVG5DuDMkWnGdlFJMHNgO_2N3UhX_ZZWQEUH8/s320/figure2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
But now you have &quot;F1=1&quot;.&lt;br /&gt;
This &quot;F1&quot; is called figure handle and it lets you a lot more than just opening a window.&lt;br /&gt;
Even if you open a new figure without assigning a figure handle it still generates that number, but since it&#39;s not stored in anything it gets disregarded (well, almost).&lt;br /&gt;
&lt;br /&gt;
Now type get(F1)&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/AVvXsEhza9EglbqYvRL0Wo5H5DZLAz_lPZ-UXRGhDA1VOjqIH-vu66F3xFxBd5WGZk2hMgG8PhTq4JDe-HJ6yDT4bsxhw5r3EEy_eISA1ojafEUYHsSRzZZprYWqE2OdruPethHB2nBnz-L5dac/s1600/GET.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhza9EglbqYvRL0Wo5H5DZLAz_lPZ-UXRGhDA1VOjqIH-vu66F3xFxBd5WGZk2hMgG8PhTq4JDe-HJ6yDT4bsxhw5r3EEy_eISA1ojafEUYHsSRzZZprYWqE2OdruPethHB2nBnz-L5dac/s400/GET.png&quot; width=&quot;298&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
A whole bunch of information show up.&lt;br /&gt;
These are the summary of the specifications describing the figure you just opened.&lt;br /&gt;
&quot;get(figure handle)&quot; show you all about that figure. If you want to change something, you can try &quot;set(figure handle ...)&quot;&lt;br /&gt;
I&#39;ll talk more about &quot;get&quot; and &quot;set&quot; in the upcoming posts. &lt;br /&gt;
&lt;br /&gt;
Many other things can have a handle. If you type &quot;P1=plot(x,y)&quot; when you plot something, this will let you control and manipulate that specific plot separate from other plots.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll write what you can do with these handles next time.</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/7754699092142013558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/7754699092142013558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/7754699092142013558'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/gui-in-matlab-1.html' title='GUI in MATLAB 1'/><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/AVvXsEg7DoOulQwFQZJNLUNM079UtR-5L81DDXqRLDlw9LS8H5sWnewk7Etje3mWv-kCU_Ap0Dd76zr5WjDfzpg16SvVH-rzEMN6yqAfonBcMrhmcODlBPi_cXWBiDoQYjt1exb-lVzRl8EGB9s/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-4309826301192210307</id><published>2012-02-19T14:19:00.000-08:00</published><updated>2012-02-19T14:19:10.092-08:00</updated><title type='text'>C and Visual Studio 2010</title><content type='html'>It looks like MS Visual Studio (VS) is really well designed for C++.&lt;br /&gt;
Visual Studio is simply a compilation of many &quot;Visual ...&quot; programs. Visual Basic, Visual C++, Visual...whatever.&lt;br /&gt;
&lt;br /&gt;
Check out &lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_Visual_Studio&quot; target=&quot;_blank&quot;&gt;the wikipedia page&lt;/a&gt; for more information regarding what else the VS has.&lt;br /&gt;
&lt;br /&gt;
Since it&#39;s used more for C++ than C, you need to change a few things to use it with C.&lt;br /&gt;
&lt;br /&gt;
I use VS2010, so the following pictures are all from the 2010 version.&lt;br /&gt;
&lt;br /&gt;
The pictures are pretty much self explanatory. If pictures are too small, click them. They&#39;ll enlarge.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Start VS2010.&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYM4Dp_carpkNIyt8EaROuQFfMX0OdllZEEn3o69sO1pR7a3laHNkmwtsYVtI4Sc56ZEUt_eQpwHkQ83v1uL5vvCf3D2-4dXQXkZiFoxNQ8TnRrR-pmpNnzUddSiRuj_Db-GMnAeZ5zXQ/s1600/VS.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;272&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYM4Dp_carpkNIyt8EaROuQFfMX0OdllZEEn3o69sO1pR7a3laHNkmwtsYVtI4Sc56ZEUt_eQpwHkQ83v1uL5vvCf3D2-4dXQXkZiFoxNQ8TnRrR-pmpNnzUddSiRuj_Db-GMnAeZ5zXQ/s400/VS.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;It&#39;s starting&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzaFWRsLx0Qms4lACe7ft5QAmmOdhgZhI35modO7zinz1I4w6RWgiZj2SQlQwO4pOy_6Ej8DRbpPodStYK_moYLc18I8yTOGNZU5cKx02scnQ3SuruufjfGlaz3zIaPct_Lr-AvZM4nJg/s1600/VS1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;278&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzaFWRsLx0Qms4lACe7ft5QAmmOdhgZhI35modO7zinz1I4w6RWgiZj2SQlQwO4pOy_6Ej8DRbpPodStYK_moYLc18I8yTOGNZU5cKx02scnQ3SuruufjfGlaz3zIaPct_Lr-AvZM4nJg/s400/VS1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;This is the first thing you&#39;ll see.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp; &lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUUAYgyVaKIA7wxAZE1cZwBG8CMh9_CL352ixjqXkWmyjcvm1Y40clwNag-6LtZWTT1pVXAzTm5-QaHZ5tJQLp4j3pY3ryAAZTQOxcakYLk1u0RmLivFFnUB8Gvi1is150EyuN3jNEnVc/s1600/VS2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;276&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUUAYgyVaKIA7wxAZE1cZwBG8CMh9_CL352ixjqXkWmyjcvm1Y40clwNag-6LtZWTT1pVXAzTm5-QaHZ5tJQLp4j3pY3ryAAZTQOxcakYLk1u0RmLivFFnUB8Gvi1is150EyuN3jNEnVc/s400/VS2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Do as it says.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPkn_ZWpKMCau4yObpOMPtAPD3flAKy3-4TGQSVvgSPwEz39b869c3uC8JR0KkKOQ0_D15qE0lD_PsmreyGEfVfGSzvxl09dy2vQNbzFFuWN7FTDzfBKV5ZkX2l-N-FGrRR_g8kqbfowo/s1600/VS3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPkn_ZWpKMCau4yObpOMPtAPD3flAKy3-4TGQSVvgSPwEz39b869c3uC8JR0KkKOQ0_D15qE0lD_PsmreyGEfVfGSzvxl09dy2vQNbzFFuWN7FTDzfBKV5ZkX2l-N-FGrRR_g8kqbfowo/s400/VS3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Keep on going.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT9hSzXv-HidT0zLGstYbiXz6-yrps0wuK2ZQb4Gjq8jmrbPm9xAfMvEMInHyXyjY2m-Wqaaf510__6nEjjcR0q6Ur5PSEXuEe3m1Wn7-jAlCVfzK0_lH5XpDptMaJOuZdjDsb8BCBYR8/s1600/VS4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;340&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT9hSzXv-HidT0zLGstYbiXz6-yrps0wuK2ZQb4Gjq8jmrbPm9xAfMvEMInHyXyjY2m-Wqaaf510__6nEjjcR0q6Ur5PSEXuEe3m1Wn7-jAlCVfzK0_lH5XpDptMaJOuZdjDsb8BCBYR8/s400/VS4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;You may want to choose differently later, but if you&#39;re just starting out C, do as it says.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu72l2IeFY4ieUzZbFAYHsNMtEANPNGWAsAy3JzXcWMlFaFy-5PcnQUmdXModWPVXUQF3bjF28uAnU9C-06EyJ-mO4wIr97BbCjgKQuDAr8yjw7s-B1eCJI7kka9Td-sOTt12bfgkxVAA/s1600/VS5.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;278&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu72l2IeFY4ieUzZbFAYHsNMtEANPNGWAsAy3JzXcWMlFaFy-5PcnQUmdXModWPVXUQF3bjF28uAnU9C-06EyJ-mO4wIr97BbCjgKQuDAr8yjw7s-B1eCJI7kka9Td-sOTt12bfgkxVAA/s400/VS5.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Keep going.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&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;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii2YRtDlqdHj5Eh1L9vowlWlKbIXwrHEKD7KXvDfhvvJwmUY_lFjXAmKaThPSAdoNgmeDHd71h5fFoI3ZtNo0DqnWmFrv5ex-9lEIEFYrReZ7IetXqADhH8yfnZNcK-wOXLwk8pM11GWw/s1600/VS6.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;276&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii2YRtDlqdHj5Eh1L9vowlWlKbIXwrHEKD7KXvDfhvvJwmUY_lFjXAmKaThPSAdoNgmeDHd71h5fFoI3ZtNo0DqnWmFrv5ex-9lEIEFYrReZ7IetXqADhH8yfnZNcK-wOXLwk8pM11GWw/s400/VS6.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Continue.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp; &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/AVvXsEinCcHEiVN3WYfZoMTjWdS_mcgFMRKRtTmTJf98OEZeR_g0wdykiXRz3C_8BlBjpdgUeqk89jh54V3bcqtES_5oj8nRktZOolqFxO8rmU2BMXO-X-4nh6xI6NAHq6oAEDwLCz5Js0aN1ok/s1600/VS7.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;278&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinCcHEiVN3WYfZoMTjWdS_mcgFMRKRtTmTJf98OEZeR_g0wdykiXRz3C_8BlBjpdgUeqk89jh54V3bcqtES_5oj8nRktZOolqFxO8rmU2BMXO-X-4nh6xI6NAHq6oAEDwLCz5Js0aN1ok/s400/VS7.png&quot; width=&quot;400&quot; /&gt;&lt;/a&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/AVvXsEiZa8JigMj_jd0YhCRiUzHLBymDZgA2HoIxHJvoKo1MtIi8mZSPQLgBf-48f3A8nJq_kY65D7unGGRAtMuByTTKmngjhwMh9im0jaXtxumIB0DZdeIeGTUwa5LSWZkEaONt8TfL6ms-brU/s1600/VS9.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;278&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZa8JigMj_jd0YhCRiUzHLBymDZgA2HoIxHJvoKo1MtIi8mZSPQLgBf-48f3A8nJq_kY65D7unGGRAtMuByTTKmngjhwMh9im0jaXtxumIB0DZdeIeGTUwa5LSWZkEaONt8TfL6ms-brU/s400/VS9.png&quot; width=&quot;400&quot; /&gt;&lt;/a&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/AVvXsEjfT2G2oucRiS0Xt6pe30DU4v-tNpeYsrb68Qi5-H_99ldgXuRjIN9dupNmBJHDM-GkuMbcmxObZHcbd2v41Ij_fj2rwUOSDO82AZGaZHMfOO2S21byQqxnzPTgk9hmCbUwrwwrXiPh6Ho/s1600/VS10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3v84jsHjRg7H_DLvO6ytJcMv9x87dOwq0Ye83Kgs8ehma_p94qAG6O7FWD3x9YN8oTK3pWKyoeJGv1YnVAfmfInsY-GLfMwejHLSLWhUh1f3dXHu_q3lUnqf8yh6tl4nCAo59mtdE3sk/s1600/VS10.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;283&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3v84jsHjRg7H_DLvO6ytJcMv9x87dOwq0Ye83Kgs8ehma_p94qAG6O7FWD3x9YN8oTK3pWKyoeJGv1YnVAfmfInsY-GLfMwejHLSLWhUh1f3dXHu_q3lUnqf8yh6tl4nCAo59mtdE3sk/s400/VS10.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;This is the last step. Now VS is ready for C programming.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
That&#39;s it. I know it&#39;s a bit of hassle, but you&#39;ll get used to it.&lt;br /&gt;
&lt;br /&gt;
There&#39;s a small problem. You need to do this every time you start a new project. If you open an existing project, the VS will know what you were doing before.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/4309826301192210307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/c-and-visual-studio-2010.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/4309826301192210307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/4309826301192210307'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/c-and-visual-studio-2010.html' title='C and Visual Studio 2010'/><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/AVvXsEhYM4Dp_carpkNIyt8EaROuQFfMX0OdllZEEn3o69sO1pR7a3laHNkmwtsYVtI4Sc56ZEUt_eQpwHkQ83v1uL5vvCf3D2-4dXQXkZiFoxNQ8TnRrR-pmpNnzUddSiRuj_Db-GMnAeZ5zXQ/s72-c/VS.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1728010849620533535.post-1688043967159870187</id><published>2012-02-14T16:34:00.000-08:00</published><updated>2012-02-18T10:33:58.443-08:00</updated><title type='text'>Why programming?</title><content type='html'>&lt;br /&gt;
I&#39;m a mechanical engineer who plays with FORTRAN a lot.&lt;br /&gt;
Yes, I said FORTRAN. Some people still use it.&lt;br /&gt;
&lt;br /&gt;
I often tell people that I&#39;m a semi-software engineer (because I work with endless lines of codes), but at one point I realized that I don&#39;t know much about any &quot;practical&quot; programming skills.&lt;br /&gt;
&lt;br /&gt;
For example, if my friend ask me to write a simple program that does something simple on his computer, I don&#39;t know where to start. Bummer. What kind of software engineer is that?&lt;br /&gt;
&lt;br /&gt;
So I decided to learn more of different programming languages. More than I need to know for my daily function.&lt;br /&gt;
&lt;br /&gt;
I started with C just because that&#39;s where everyone starts. After C, it&#39;ll be C++. After C++, I&#39;ll study php, SQL, and HTML.&lt;br /&gt;
&lt;br /&gt;
This blog will be a progress report for myself and guidance for those who want to try something different than ordinary.</content><link rel='replies' type='application/atom+xml' href='http://semiproprogrammer.blogspot.com/feeds/1688043967159870187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/why-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/1688043967159870187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1728010849620533535/posts/default/1688043967159870187'/><link rel='alternate' type='text/html' href='http://semiproprogrammer.blogspot.com/2012/02/why-programming.html' title='Why programming?'/><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>