{"id":76,"date":"2007-07-16T08:51:09","date_gmt":"2007-07-16T13:51:09","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2007\/07\/16\/closing-time-at-the-document-bar\/"},"modified":"2007-08-15T14:35:43","modified_gmt":"2007-08-15T19:35:43","slug":"closing-time-at-the-document-bar","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2007\/07\/16\/closing-time-at-the-document-bar\/","title":{"rendered":"Closing Time at the Document Bar"},"content":{"rendered":"<p>When you are done working with a \u201cdocument\u201d (M-File in the Editor, variable in the Array Editor, docked Figure, etc.) MATLAB offers a plethora of ways to close it:<\/p>\n<ul>\n<li>You can select File->Close <em>my document<\/em> from the menu<\/li>\n<li>You can press Ctrl-W (while the document has focus)<\/li>\n<li>You can click the X to the upper right of the document<\/li>\n<li>You can click the X on the document bar button (tab) corresponding to the document<\/li>\n<li>You can even right click on the document bar button and select Close <em>my document<\/em> from the context menu.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/DocumentCloseControls.png\"><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/DocumentCloseControls_sm.jpg\"><\/a><\/p>\n<p>What more could you want?<\/p>\n<p>Well if the document you are closing is an M-File with unsaved changes; you probably want MATLAB to prompt you regarding the disposition of the changes.  Indeed, MATLAB will do so in response to any of the above close gestures.  If you happen to know that you want to discard your changes you can avoid the prompting dialog by holding down the Ctrl key while pressing either of the X\u2019s.  MATLAB will respond by closing the document and discarding any changes without prompting you.  This Ctrl key trick extends to closing the Editor itself.  If you hold down the Ctrl key and press the X on the Editor\u2019s title bar, the Editor will close, discarding unsaved changes to all files.<\/p>\n<p>Sometimes, instead of closing a particular document you might want to keep a particular document open and close all the others.   As of R2006b, the document bar button context menu offers a \u201cClose all except <em>my document<\/em>&#8221; item for just this eventuality.  This can be handy but it can also be frustrating when you instead want to keep a few documents open rather than just one.  Here\u2019s this menu item offering to do almost, but not quite, what you want.  The solution is to use the \u201cClose\u2026\u201d item that also appears on the context menu as well as on the File menu.  This item has been present since R2006b.  Close\u2026 opens a dialog that lets you choose which files to close.<\/p>\n<p><img decoding=\"async\" id=\"image78\" alt=\"Close Dialog\" src=\"https:\/\/blogs.mathworks.com\/community\/..\/images\/desktop\/CloseDialog.png\" \/><\/p>\n<p>In order to use this dialog to close all but a few documents, click the \u201cSelect All\u201d button, then within the list at the left individually deselect the documents you want to keep open.  Click the \u201cClose Selected\u201d button and MATLAB will do your bidding.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you are done working with a \u201cdocument\u201d (M-File in the Editor, variable in the Array Editor, docked Figure, etc.) MATLAB offers a plethora of ways to close it:<\/p>\n<p>You can select File->Close my&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2007\/07\/16\/closing-time-at-the-document-bar\/\">read more >><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,9],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/76"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}