{"id":761,"date":"2013-02-08T10:19:06","date_gmt":"2013-02-08T15:19:06","guid":{"rendered":"https:\/\/blogs.mathworks.com\/steve\/?p=761"},"modified":"2013-04-12T08:42:31","modified_gmt":"2013-04-12T13:42:31","slug":"revisiting-dctdemo-part-1","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/steve\/2013\/02\/08\/revisiting-dctdemo-part-1\/","title":{"rendered":"Revisiting dctdemo &#8211; Part 1"},"content":{"rendered":"<div class=\"content\"><p>Last month, Dave Garrison wrote a <a href=\"https:\/\/www.mathworks.com\/company\/newsletters\/articles\/writing-apps-in-matlab.html\">nice article<\/a> on the MathWorks web site about coding an app (or GUI) by defining a class.<\/p><p>Curiously, this article made me think of a day back in September 1993. I arrived at MathWorks on that day to interview for a job as an image processing software developer. Sometime in the afternoon I found myself in an office with the two developers of version 1.0 of the Image Processing Toolbox. (One of those developers, Loren Shure, was the first employee hired by the MathWorks founders. You can find her over at <a href=\"https:\/\/blogs.mathworks.com\/loren\">Loren on the Art of MATLAB<\/a>.)<\/p><p>Anyway, the Image Processing Toolbox was about to ship, and the developers were trying to think of some demo ideas. I joined in a brainstorming session in front of a whiteboard. One of my ideas that day became the product demo called <tt>dctdemo<\/tt>. Here is a screen shot.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2013\/dctdemo-screen-shot.png\" alt=\"\"> <\/p><p>(That's a picture of Loren, by the way.)<\/p><p>Prompted by Dave's article, I thought it might be a good time to revisit this oldie-but-goodie demo. It was originally written using MATLAB 4, and the programming techniques available at that time for doing this sort of thing were relatively crude. My plan is to take a fresh look at this demo and reimplement it using the techniques described by Dave.<\/p><p>Here's a start:<\/p><pre class=\"language-matlab\"><span class=\"keyword\">classdef<\/span> dctCompressionDemo &lt; handle\r\n<\/pre><pre class=\"language-matlab\"><span class=\"keyword\">end<\/span>\r\n<\/pre><p>That's enough code to actually execute.<\/p><pre class=\"codeinput\">dctCompressionDemo\r\n<\/pre><pre class=\"codeoutput\">\r\nans = \r\n\r\n  dctCompressionDemo handle with no properties.\r\n\r\n<\/pre><p>And that's about all it does (for now). Next time we'll start filling in the details.<\/p>\r\n<div><ul><li><a href=\"https:\/\/blogs.mathworks.com\/steve\/2013\/02\/08\/revisiting-dctdemo-part-1\/\">Revisiting dctdemo - part 1<\/a><\/li><li><a href=\"https:\/\/blogs.mathworks.com\/steve\/2013\/02\/21\/revisiting-dctdemo-part-2\/\">Revisiting dctdemo - part 2<\/a><\/li><li><a href=\"https:\/\/blogs.mathworks.com\/steve\/2013\/03\/21\/revisiting-dctdemo-part-3\/\">Revisiting dctdemo - part 3<\/a><\/li><li><a href=\"https:\/\/blogs.mathworks.com\/steve\/2013\/04\/12\/revisiting-dctdemo-part-4\/\">Revisiting dctdemo - part 4<\/a><\/li><\/ul><\/div>\r\n<script language=\"JavaScript\"> <!-- \r\n    function grabCode_ac4a98d2dc6a4b8c94b3a679ec387ad6() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='ac4a98d2dc6a4b8c94b3a679ec387ad6 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' ac4a98d2dc6a4b8c94b3a679ec387ad6';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2013 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_ac4a98d2dc6a4b8c94b3a679ec387ad6()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2012b<br><\/p><p class=\"footer\"><br>\r\n      Published with MATLAB&reg; R2012b<br><\/p><\/div><!--\r\nac4a98d2dc6a4b8c94b3a679ec387ad6 ##### SOURCE BEGIN #####\r\n%%\r\n% Last month, Dave Garrison wrote a\r\n% <https:\/\/www.mathworks.com\/company\/newsletters\/articles\/writing-apps-in-matlab.html\r\n% nice article> on the MathWorks web site about coding an app (or GUI) by\r\n% defining a class.\r\n%\r\n% Curiously, this article made me think of a day back in September 1993. I\r\n% arrived at MathWorks on that day to interview for a job as an image\r\n% processing software developer. Sometime in the afternoon I found myself\r\n% in an office with the two developers of version 1.0 of the Image Processing\r\n% Toolbox. (One of those developers, Loren Shure, was the first employee\r\n% hired by the MathWorks founders. You can find her over at\r\n% <https:\/\/blogs.mathworks.com\/loren Loren on the Art of MATLAB>.)\r\n%\r\n% Anyway, the Image Processing Toolbox was about to ship, and the\r\n% developers were trying to think of some demo ideas. I joined in a\r\n% brainstorming session in front of a whiteboard. One of my ideas that\r\n% day became the product demo called |dctdemo|. Here is a screen shot.\r\n%\r\n% <<https:\/\/blogs.mathworks.com\/images\/steve\/2013\/dctdemo-screen-shot.png>>\r\n%\r\n% (That's a picture of Loren, by the way.)\r\n%\r\n% Prompted by Dave's article, I thought it might be a good time to revisit\r\n% this oldie-but-goodie demo. It was originally written using MATLAB 4, and\r\n% the programming techniques available at that time for doing this sort of\r\n% thing were relatively crude. My plan is to take a fresh look at this demo\r\n% and reimplement it using the techniques described by Dave.\r\n%\r\n% Here's a start:\r\n%\r\n%   classdef dctCompressionDemo < handle\r\n%\r\n%   end\r\n%\r\n% That's enough code to actually execute.\r\n\r\ndctCompressionDemo\r\n\r\n%%\r\n% And that's about all it does (for now). Next time we'll start filling in\r\n% the details.\r\n##### SOURCE END ##### ac4a98d2dc6a4b8c94b3a679ec387ad6\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/steve\/2013\/dctdemo-screen-shot.png\" onError=\"this.style.display ='none';\" \/><\/div><p>Last month, Dave Garrison wrote a nice article on the MathWorks web site about coding an app (or GUI) by defining a class.Curiously, this article made me think of a day back in September 1993. I... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/steve\/2013\/02\/08\/revisiting-dctdemo-part-1\/\">read more >><\/a><\/p>","protected":false},"author":42,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/761"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/comments?post=761"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/761\/revisions"}],"predecessor-version":[{"id":830,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/posts\/761\/revisions\/830"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/media?parent=761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/categories?post=761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/steve\/wp-json\/wp\/v2\/tags?post=761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}