{"id":438,"date":"2010-03-30T19:39:12","date_gmt":"2010-03-30T19:39:12","guid":{"rendered":"https:\/\/blogs.mathworks.com\/videos\/2010\/03\/30\/deleting-an-element-from-a-cell-array\/"},"modified":"2018-01-08T20:55:52","modified_gmt":"2018-01-09T01:55:52","slug":"deleting-an-element-from-a-cell-array","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/videos\/2010\/03\/30\/deleting-an-element-from-a-cell-array\/","title":{"rendered":"Deleting an element from a cell array"},"content":{"rendered":"I recently had a situation where I needed to delete an entry from a cell array.  When I tried A{3} = [ ], I did not delete the third element, I actual just set it to [ ].\r\n\r\n\r\n<p>\r\n<iframe loading=\"lazy\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/lfhPJjEOUlw?feature=oembed\" frameborder=\"0\" gesture=\"media\" allow=\"encrypted-media\" allowfullscreen><\/iframe>\r\n<p>\r\n\r\nWhat <a href=\"https:\/\/blogs.mathworks.com\/loren\/\">Loren<\/a> helped me realize is that cell arrays use () just like regular MATLAB arrays to index into elements of the array, while preserving type of the container.  i.e., index into a numeric array with () and you\u2019ll get a numeric array back.  Index into a cell array with () and you\u2019ll get a cell array back.  {} represents an additional syntax to access the underlying data.","protected":false},"excerpt":{"rendered":"<p>I recently had a situation where I needed to delete an entry from a cell array.  When I tried A{3} = [ ], I did not delete the third element, I actual just set it to [ ].\r\n\r\n\r\n\r\n\r\n\r\n\r\nWhat Loren&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/videos\/2010\/03\/30\/deleting-an-element-from-a-cell-array\/\">read more >><\/a><\/p>","protected":false},"author":68,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,17],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/438"}],"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\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/comments?post=438"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/438\/revisions"}],"predecessor-version":[{"id":3334,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/posts\/438\/revisions\/3334"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/media?parent=438"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/categories?post=438"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/videos\/wp-json\/wp\/v2\/tags?post=438"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}