{"id":355,"date":"2016-09-13T12:26:26","date_gmt":"2016-09-13T12:26:26","guid":{"rendered":"https:\/\/carson.fenimorefamily.com\/?p=355"},"modified":"2016-09-13T12:28:45","modified_gmt":"2016-09-13T12:28:45","slug":"random-opinions-of-matlab","status":"publish","type":"post","link":"https:\/\/carson.fenimorefamily.com\/?p=355","title":{"rendered":"Random Opinions of MATLAB"},"content":{"rendered":"<p>While working on my Masters at BYU I had a professor that did all his demonstrations in MATLAB.  It was as if nobody had told him that they had invented other languages.  Or he just really loved MATLAB.<\/p>\n<p>Lately I&#8217;ve been doing a project where I&#8217;ve had to experience the joy of using MATLAB.  As a numerical processing suite it definitely effective:  concise, quick, easy.  It is also quirky.  I thought I&#8217;d log a few observations for posterity.<\/p>\n<p>First, the editor has some nice things: autocomplete, lots of suggestions for writing more idiomatic MATLAB. For example: <\/p>\n<ul>\n<li>number conversion &#8211;  i was tempted to use str2num, which does work, but MATLAB suggested str2double, which also works but is mo&#8217; betta<\/li>\n<li>string finding &#8211; Of course there is a findstr and strfind&#8230; you guess which one MATLAB prefers.  The MATLAB will correct you. (hint: its strfind)<\/li>\n<li>printing &#8211; My very first transgression was trying to log statements using disp(sprintf(&#8216;stuff: %s))&#8230; For some reason i found sprintf but didn&#8217;t yet know that disp(sprintf()) is analogous to fprintf()&#8230; but MATLAB wasn&#8217;t afraid to correct me<\/li>\n<\/ul>\n<p>Matlab has a ton of quirks:<\/p>\n<ul>\n<li>\nThe editor is SOOO WEIRD.  Examples: weird key combos for copy and paste&#8230; seriously, Alt+2??  Where are my vim bindings?\n<\/li>\n<li>Performance of deeply nested classes.  Deeply meaning depth > 1.  I wrote a file reader class. The reader had a data member that allocated a large array. Performance went in the gutter.  Then I moved the array to the same level as the file reader, keeping all logic the same, and performance was better.  Why oh why would it matter.  I don&#8217;t know, but it does.<\/li>\n<li>Weird behavior when return value not specified.  I realized c++ does this.  If you don&#8217;t specify a return on a non-void function, bad things can happen.  I&#8217;d expect more from a (presumably) high-level language like MATLAB.<\/li>\n<li>paths.  I think the notion of having code paths is weird.  Why not just have a project with all the paths set up?<\/li>\n<\/ul>\n<p>Except for the editor, which is appalling, I actually find MATLAB quite usable.  I wouldn&#8217;t claim it is superior to python, just different.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While working on my Masters at BYU I had a professor that did all his demonstrations in MATLAB. It was as if nobody had told him that they had invented other languages. Or he just really loved MATLAB. Lately I&#8217;ve been doing a project where I&#8217;ve had to experience the joy of using MATLAB. As &hellip; <a href=\"https:\/\/carson.fenimorefamily.com\/?p=355\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Random Opinions of MATLAB<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-355","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=355"}],"version-history":[{"count":2,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/355\/revisions"}],"predecessor-version":[{"id":357,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=\/wp\/v2\/posts\/355\/revisions\/357"}],"wp:attachment":[{"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/carson.fenimorefamily.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}