{"id":11341,"date":"2020-03-06T09:00:42","date_gmt":"2020-03-06T14:00:42","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=11341"},"modified":"2020-03-06T10:43:00","modified_gmt":"2020-03-06T15:43:00","slug":"progressbar","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2020\/03\/06\/progressbar\/","title":{"rendered":"progressbar"},"content":{"rendered":"<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/76890\">Will<\/a>&#8216;s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/6922-progressbar\">progressbar<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/870024-steve-hoelzer\">Steve Hoelzer<\/a>.<\/p>\n<p>This is a File Exchange contribution that has been around since at least 2005. It has 76 downloads in the past 30 days and a 5 star rating from 122 votes. With a pedigree like this, I was shocked to find that the submission has never been a pick of the week. Jiro picked <a href=\"https:\/\/blogs.mathworks.com\/pick\/2010\/07\/23\/automatic-progress-bar\/\">something similar<\/a> in 2010. That one appears to have fallen out of usage, but Steve&#8217;s keeps on truckin.<\/p>\n<p>Steve&#8217;s code hasn&#8217;t been altered in a decade, yet it continues to work in R2019b. It&#8217;s simple enough to use. You call progressbar to initialize the figure. A timer is kicked off behind the scenes. Inside your for loop, you call progressbar again, providing it a percentage of completion. This updates the figure and gives you an estimate of when the overall task will complete.<\/p>\n<p>This works just fine if you have one task, but progressbar goes the extra mile and provides support for multiple tasks if you have nested loops. Here&#8217;s an example provided in the function:<br \/>\n<a href=\"https:\/\/blogs.mathworks.com\/pick\/files\/potw_progressbar_code.jpg\"><img decoding=\"async\" loading=\"lazy\" width=\"700\" height=\"357\" class=\"alignnone size-full wp-image-11359\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/potw_progressbar_code.jpg\" alt=\"\" \/><\/a><\/p>\n<p>The results looks like this:<br \/>\n<a href=\"https:\/\/blogs.mathworks.com\/pick\/files\/potw_progressbar.gif\"><img decoding=\"async\" loading=\"lazy\" width=\"616\" height=\"148\" class=\"alignnone size-full wp-image-11355\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/potw_progressbar.gif\" alt=\"\" \/><\/a><\/p>\n<p>Let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=11341#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/6922-progressbar#comments\">comment<\/a> for Steve.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/pick\/files\/potw_progressbar_code.jpg\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Will&#8216;s pick this week is progressbar by Steve Hoelzer.<br \/>\nThis is a File Exchange contribution that has been around since at least 2005. It has 76 downloads in the past 30 days and a 5 star rating&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2020\/03\/06\/progressbar\/\">read more >><\/a><\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[28],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11341"}],"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\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=11341"}],"version-history":[{"count":8,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11341\/revisions"}],"predecessor-version":[{"id":11365,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/11341\/revisions\/11365"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=11341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=11341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=11341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}