{"id":913,"date":"2005-09-01T12:57:26","date_gmt":"2005-09-01T17:57:26","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=913"},"modified":"2016-10-14T10:35:05","modified_gmt":"2016-10-14T14:35:05","slug":"flip-arrays","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2005\/09\/01\/flip-arrays\/","title":{"rendered":"Flip Arrays"},"content":{"rendered":"<p><div class=\"alert alert-info\"> <span class=\"alert_icon icon-alert-info-reverse\"><\/span><p class=\"alert_heading\"><strong>Note<\/strong><\/p><p>The file submission referenced in this post is no longer available on File Exchange.<\/p><\/div><br \/>\nI love small, simple, useful functions. Many of my own submissions are not much more than one line of code (wopen, goto) that I use dozens of times a week. Duane Hanselman submitted a great one the other day. FLIPARRAY works just like FLIPUD and FLIPLR, except that it doesn&#8217;t require you to figure out if the input is a row or column vector first. It also extends nicely to support multidimensional arrays, preserving the array shape.<\/p>\n<p>Duane received some grief over such a &#8220;simple&#8221; submission, including a nomination for removal. I couldn&#8217;t disagree more &#8211; I think submissions like this make the File Exchange great, and make MATLAB much more enjoyable to live with. The fact that it&#8217;s only one line of code tells me two things:<\/p>\n<ol>\n<li>MATLAB has a very compact, efficient language.<\/li>\n<li>Duane knows how to use it to his advantage.<\/li>\n<\/ol>\n<p>I don&#8217;t know about you, but I&#8217;d much rather type:<\/p>\n<pre class=\"code\">&gt;&gt; x = fliparray(x)\r\n<\/pre>\n<p>than<\/p>\n<pre class=\"code\">&gt;&gt; x(:)=x(end:-1:1); \r\n<\/pre>\n<p>It takes less thought, is easier to type, and makes my code infinitely more readable. Thanks, Duane.<\/p>\n","protected":false},"excerpt":{"rendered":"<p> NoteThe file submission referenced in this post is no longer available on File Exchange.<br \/>\nI love small, simple, useful functions. Many of my own submissions are not much more than one line of code&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2005\/09\/01\/flip-arrays\/\">read more >><\/a><\/p>\n","protected":false},"author":33,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/913"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=913"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/913\/revisions"}],"predecessor-version":[{"id":7936,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/913\/revisions\/7936"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}