{"id":10677,"date":"2019-04-19T09:00:12","date_gmt":"2019-04-19T13:00:12","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=10677"},"modified":"2019-04-15T17:33:35","modified_gmt":"2019-04-15T21:33:35","slug":"matlab-projects","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2019\/04\/19\/matlab-projects\/","title":{"rendered":"MATLAB Projects"},"content":{"rendered":"<div xmlns:mwsh=\"http:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\n   <introduction><\/p>\n<p><a href=\"http:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495\">Sean<\/a>&#8216;s pick this week is <a href=\"http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/65974\">MATLAB Project File<\/a> by <a href=\"http:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/11978197\">Dmitry Ratner<\/a> and the new <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/projects.html\">Projects<\/a> functionality in base MATLAB added to R2019a.  This was previously Simulink Projects but Simulink is no longer required.\n      <\/p>\n<p>   <\/introduction><\/p>\n<p>Have you ever wanted to work on a project and when starting for the day, or had a new team member start on the project, have everything configured for you?  Well now you can leave behind those <tt>addpath(genpath(pwd))<\/tt> and those instructions like &#8220;run this script before starting&#8221; or the effort to manually choose which files export when sharing with someone else!\n   <\/p>\n<p>Dmitry&#8217;s File Exchange submission provides a means for configuring the path, shortcuts, and a startup script and works in older versions of MATLAB.  Projects in base MATLAB also do this but go much further by allowing export capabilities, shut down files, upgrade advisors, categories for different files, graphical dependency and product analysis, integration with source control and more.\n   <\/p>\n<p>Here I will describe how to create a project from an existing set of files and configure it.  I will use the &#8220;Pick of the Week&#8221; Folder where I keep all of the blog entries and utilities to publish them.\n   <\/p>\n<p>First, create a new project.  I usually do this by going from an existing folder to a project (even if the existing folder is under source control).\n   <\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmatlabproject\/newprj.png\"> <\/p>\n<p>Give it a descriptive name and then set it up.  Set up will ask you which folders to add to the path.<\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmatlabproject\/addpaths.png\"> <\/p>\n<p>You can then specify anything to run when starting or shutting down the project.  I don&#8217;t need that here.<\/p>\n<p>Next you can create custom labels or use the existing ones to label files in the project.  A filter can then be applied to show just those files.\n   <\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmatlabproject\/cats.png\"> <\/p>\n<p>If you&#8217;d like to see dependencies in the project, you can right click on a file to view it&#8217;s dependencies as a graph, or the files impacted by it if you want to change it.  This will also point out project dependencies and potential missing files required for your code to run.\n   <\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmatlabproject\/impact.png\"> <\/p>\n<p>You can run checks against the project, upgrade it at once (more important for Simulink workflows), and manage source control all from within the project toolstrips, and have custom tasks or shortcuts.\n   <\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmatlabproject\/checks.png\"> <\/p>\n<p>Additionally, you can replace anywhere that needs to find the location of a file using <tt>mfilename('fullpath')<\/tt> with the <i>RootFolder<\/i> property of <tt>currentProject<\/tt>.\n   <\/p>\n<pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">prj = currentProject<\/pre>\n<pre style=\"font-style:oblique\">prj = \r\n  Project with properties:\r\n\r\n                        Name: \"potw\"\r\n    SourceControlIntegration: \"Git\"\r\n          RepositoryLocation: \"http:\/\/insidelabs-git.mathworks.com\/sdewolsk\/potw.git\"\r\n       SourceControlMessages: [1&times;3 string]\r\n                    ReadOnly: 0\r\n                    TopLevel: 1\r\n                Dependencies: [1&times;1 digraph]\r\n                  Categories: [1&times;1 matlab.project.Category]\r\n                       Files: [1&times;4604 matlab.project.ProjectFile]\r\n                   Shortcuts: [1&times;0 matlab.project.Shortcut]\r\n                 ProjectPath: [1&times;19 matlab.project.PathFolder]\r\n           ProjectReferences: [1&times;0 matlab.project.ProjectReference]\r\n                StartupFiles: [1&times;0 string]\r\n               ShutdownFiles: [1&times;0 string]\r\n                 Description: \"\"\r\n                  RootFolder: \"C:\\Documents\\MATLAB\\potw\"\r\n        ProjectStartupFolder: \"C:\\Documents\\MATLAB\\potw\\MatlabProject\"\r\n         SimulinkCacheFolder: \"\"\r\n       SimulinkCodeGenFolder: \"\"\r\n<\/pre>\n<p>I hope you&#8217;re as excited about Projects in MATLAB as I am.  I&#8217;ve been using them since the prerelease became available to us and it has made my day to day project work much easier.\n   <\/p>\n<h3>Comments<a name=\"3\"><\/a><\/h3>\n<p>Give it MATLAB projects a try and let us know what you think <a href=\"http:\/\/blogs.mathworks.com\/pick\/?p=10677#respond\">here<\/a> or leave a <a href=\"http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/65974#comments\">comment<\/a> for Dmitry.\n   <\/p>\n<p><script language=\"JavaScript\">\n<!--\n\n    function grabCode_ef6a307457bb474aaa9bda70c4694804() {\n        \/\/ Remember the title so we can use it in the new page\n        title = document.title;\n\n        \/\/ Break up these strings so that their presence\n        \/\/ in the Javascript doesn't mess up the search for\n        \/\/ the MATLAB code.\n        t1='ef6a307457bb474aaa9bda70c4694804 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\n        t2='##### ' + 'SOURCE END' + ' #####' + ' ef6a307457bb474aaa9bda70c4694804';\n    \n        b=document.getElementsByTagName('body')[0];\n        i1=b.innerHTML.indexOf(t1)+t1.length;\n        i2=b.innerHTML.indexOf(t2);\n \n        code_string = b.innerHTML.substring(i1, i2);\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\n\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \n        \/\/ in the XML parser.\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\n        \/\/ doesn't go ahead and substitute the less-than character. \n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\n\n        author = 'Sean de Wolski';\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\n\n        w = window.open();\n        d = w.document;\n        d.write('\n\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\n\n\\n');\n      \n      d.title = title + ' (MATLAB code)';\n      d.close();\n      }   \n      \n-->\n<\/script><\/p>\n<p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><a href=\"javascript:grabCode_ef6a307457bb474aaa9bda70c4694804()\"><span style=\"font-size: x-small;        font-style: italic;\">Get<br \/>\n            the MATLAB code<br \/>\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><\/p>\n<p>      Published with MATLAB&reg; R2019a<\/p>\n<\/div>\n<p><!--\nef6a307457bb474aaa9bda70c4694804 ##### SOURCE BEGIN #####\n%% MATLAB Projects \n% \n% <http:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495 Sean>'s\n% pick this week is\n% <http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/65974 MATLAB Project\n% File> by <http:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/11978197\n% Dmitry Ratner> and the new\n% <https:\/\/www.mathworks.com\/help\/matlab\/projects.html Projects>\n% functionality in base MATLAB added to R2019a.  This was previously\n% Simulink Projects but Simulink is no longer required.\n% \n\n%% \n%\n% Have you ever wanted to work on a project and when starting for the day,\n% or had a new team member start on the project, have everything configured\n% for you?  Well now you can leave behind those |addpath(genpath(pwd))| and\n% those instructions like \"run this script before starting\" or the effort\n% to manually choose which files export when sharing with someone else!\n%\n% Dmitry's File Exchange submission provides a means for configuring the\n% path, shortcuts, and a startup script and works in older versions of\n% MATLAB.  Projects in base MATLAB also do this but go much further by\n% allowing export capabilities, shut down files, upgrade advisors,\n% categories for different files, graphical dependency and product\n% analysis, integration with source control and more.\n%\n% Here I will describe how to create a project from an existing set of\n% files and configure it.  I will use the \"Pick of the Week\n% Folder\" where I keep all of the blog entries and utilities to publish them.\n%\n% First, create a new project.  I usually do this by going from an existing\n% folder to a project (even if the existing folder is under source\n% control).\n%\n% <<newprj.png>>\n%\n% Give it a descriptive name and then set it up.  Set up will ask you which\n% folders to add to the path.\n%\n% <<addpaths.png>>\n%\n% You can then specify anything to run when starting or shutting down the\n% project.  I don't need that here.\n%\n% Next you can create custom labels or use the existing ones to label files\n% in the project.  A filter can then be applied to show just those files.\n%\n% <<cats.png>>\n%\n% If you'd like to see dependencies in the project, you can right click on\n% a file to view it's dependencies as a graph, or the files impacted by it\n% if you want to change it.  This will also point out project dependencies\n% and potential missing files required for your code to run.\n%\n% <<impact.png>>\n%\n% You can run checks against the project, upgrade it at once (more\n% important for Simulink workflows), and manage source control all from\n% within the project toolstrips, and have custom tasks or shortcuts.\n%\n% <<checks.png>>\n%\n% Additionally, you can replace anywhere that needs to find the location of\n% a file using |mfilename('fullpath')| with the _RootFolder_ property of\n% |currentProject|.\n\nprj = currentProject\n\n%%\n% I hope you're as excited about Projects in MATLAB as I am.  I've been\n% using them since the prerelease became available to us and it has made my\n% day to day project work much easier.\n\n%% Comments\n% \n% Give it MATLAB projects a try and let us know what you think\n% <http:\/\/blogs.mathworks.com\/pick\/?p=10677#respond here> or leave a\n% <http:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/65974#comments\n% comment> for Dmitry.\n%\n \n\n##### SOURCE END ##### ef6a307457bb474aaa9bda70c4694804\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"http:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainmatlabproject\/newprj.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Sean&#8216;s pick this week is MATLAB Project File by Dmitry Ratner and the new Projects functionality in base MATLAB added to R2019a.  This was previously Simulink Projects but Simulink is no&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2019\/04\/19\/matlab-projects\/\">read more >><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10677"}],"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\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=10677"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10677\/revisions"}],"predecessor-version":[{"id":10683,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/10677\/revisions\/10683"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=10677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=10677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=10677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}