{"id":2721,"date":"2016-11-01T14:50:44","date_gmt":"2016-11-01T19:50:44","guid":{"rendered":"https:\/\/blogs.mathworks.com\/videos\/?p=2721"},"modified":"2018-04-30T19:50:54","modified_gmt":"2018-05-01T00:50:54","slug":"use-strlength-to-detect-zero-length-strings","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/videos\/2016\/11\/01\/use-strlength-to-detect-zero-length-strings\/","title":{"rendered":"Use strlength to Detect Zero Length Strings"},"content":{"rendered":"<p>You can&#8217;t use <tt>isempty<\/tt> to detect empty strings, as you would for character arrays. Instead you should check for <tt>strlength<\/tt> being equal to zero or compare with an empty character vector. See the <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/matlab_prog\/test-for-empty-strings-and-missing-values.html\">documentation <\/a>for more information.<\/p>\n<p><div class=\"row\"><div class=\"col-xs-12 containing-block\"><div class=\"bc-outer-container add_margin_20\"><videoplayer><div class=\"video-js-container\"><video data-video-id=\"5192718567001\" data-video-category=\"blog\" data-autostart=\"false\" data-account=\"62009828001\" data-omniture-account=\"mathwgbl\" data-player=\"rJ9XCz2Sx\" data-embed=\"default\" id=\"mathworks-brightcove-player\" class=\"video-js\" controls><\/video><script src=\"\/\/players.brightcove.net\/62009828001\/rJ9XCz2Sx_default\/index.min.js\"><\/script><script>if (typeof(playerLoaded) === 'undefined') {var playerLoaded = false;}(function isVideojsDefined() {if (typeof(videojs) !== 'undefined') {videojs(\"mathworks-brightcove-player\").on('loadedmetadata', function() {playerLoaded = true;});} else {setTimeout(isVideojsDefined, 10);}})();<\/script><\/div><\/videoplayer><\/div><\/div><\/div><\/p>\n<p>Play the video in full screen mode for a better viewing experience. Follow <a href=\"https:\/\/twitter.com\/stuartmcgarrity\">@stuartmcgarrity<\/a> if you want to be notified via Twitter when I post.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"thumbnail thumbnail_asset asset_overlay video\"><a href=\"https:\/\/blogs.mathworks.com\/videos\/2016\/11\/01\/use-strlength-to-detect-zero-length-strings\/?dir=autoplay\"><img decoding=\"async\" src=\"https:\/\/cf-images.us-east-1.prod.boltdns.net\/v1\/static\/62009828001\/2d26dedc-41e3-428e-80de-8de22d85ee17\/37445a1f-9b45-47f1-bdda-887b7734cdb9\/1280x720\/match\/image.jpg\" onError=\"this.style.display ='none';\"\/><\/p>\n<div class=\"overlay_container\">\n      <span class=\"icon-video icon_color_null\"><time class=\"video_length\">2:42<\/time><\/span>\n      <\/div>\n<p>      <\/a><\/div>\n<p>You can&#8217;t use isempty to detect empty strings, as you would for character arrays. Instead you should check for strlength being equal to zero or compare with an empty character vector. See the&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/videos\/2016\/11\/01\/use-strlength-to-detect-zero-length-strings\/\">read more >><\/a><\/p>\n","protected":false},"author":133,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/2721"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/users\/133"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/comments?post=2721"}],"version-history":[{"count":12,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/2721\/revisions"}],"predecessor-version":[{"id":3646,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/2721\/revisions\/3646"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/media?parent=2721"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/categories?post=2721"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/tags?post=2721"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}