{"id":8890,"date":"2019-05-16T12:42:43","date_gmt":"2019-05-16T17:42:43","guid":{"rendered":"https:\/\/blogs.mathworks.com\/simulink\/?p=8890"},"modified":"2019-05-16T12:42:43","modified_gmt":"2019-05-16T17:42:43","slug":"projects-export-profile","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2019\/05\/16\/projects-export-profile\/","title":{"rendered":"Projects Export Profile"},"content":{"rendered":"<p>After my last <a href=\"https:\/\/blogs.mathworks.com\/simulink\/2019\/04\/15\/simulink-and-the-functional-mock-up-interface-standard\">post on FMU import and export<\/a>, someone asked me if exporting a Simulink model to an FMU was a good way to hide the model and protect intellectual property.<\/p>\n<p>The answer is: <strong>No!<\/strong><\/p>\n<p>An FMU is simply a compressed archive. If you try changing the extension of an FMU to <tt>.zip<\/tt> and extracting it, you will find that it contains the original model. If you want to protect your IP, what I recommend is to <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019a\/rtw\/model-protection.html\">protect the model<\/a>. Once this is done, you can leverage the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019a\/simulink\/slref\/export-a-subset-of-a-simulink-project-using-an-export-profile.html\">project export profile feature<\/a> to automatically package only what should be shared.<\/p>\n<p>Let's look at an example project I put together to highlight this workflow.<\/p>\n<p><strong>The Project<\/strong><\/p>\n<p>Here is what my example project looks like:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/protectProject.png\" alt=\"My example project\" \/><\/p>\n<p>In this project, my top model \"f14_top.slx\" is simply a wrapper containing a <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019a\/simulink\/slref\/model.html\">Model block<\/a>. With the shortcuts \"Use Source\" and \"Use Protected\", I can re-configure it in one click to either reference <tt>f14.slx<\/tt> in normal mode or reference its protected version <tt>f14.slxp<\/tt>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/switchNormalProtected.png\" alt=\"Referencing the model\" \/><\/p>\n<p>Let's look at the details...<\/p>\n<p><strong>Project Shortcuts<\/strong><\/p>\n<p>As mentioned above, I created two MATLAB scripts that I <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019a\/matlab\/matlab_prog\/create-shortcuts-to-frequent-tasks.html\">marked as shortcuts<\/a> \"Use Source\" and \"Use Protected\". While I am developing the model, I need to work with the unprotected source model. For that, I click the \"Use Source\" shortcut, which executes:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/useNormal.png\" alt=\"Normal Mode\" \/><\/p>\n<p>When I am ready to share the project, I can build the protected target and reconfigure the top model to reference it:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/useProtected.png\" alt=\"Protected Mode\" \/><\/p>\n<p><strong>Labels<\/strong><\/p>\n<p>To differentiate the files I want to share from the rest of the project, I use <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019a\/simulink\/ug\/create-labels.html\">labels<\/a>. Those will be used later to create an export profile.<\/p>\n<p>When right-clicking on a file in the Project, I select Add Labels and can create new labels or select existing ones. In my case, I created the labels <em>Source<\/em>, <em>Protected <\/em>and <em>Internal<\/em>:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/createLabels.png\" alt=\"Creating labels\" \/><\/p>\n<p><strong>Export Profiles<\/strong><\/p>\n<p>The last thing to do is create an <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2019a\/simulink\/slref\/export-a-subset-of-a-simulink-project-using-an-export-profile.html\">export profile<\/a>, which can be done from the Share menu:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/exportProfile.png\" alt=\"Export Profile\" \/><\/p>\n<p>In my new profile, I can select which labels I do not want to be included when I will export the project.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/manageExportProfile.png\" alt=\"Manage Export Profile\" \/><\/p>\n<p>If I export the project using this profile, here is what the resulting project will look like:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/exportedProject.png\" alt=\"Exported Project\" \/><\/p>\n<p><strong>Now it's your turn<\/strong><\/p>\n<p>Do you have different workflows to protect your IP and share projects? Let us know in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/simulink\/2019Q2\/exportedProject.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>After my last post on FMU import and export, someone asked me if exporting a Simulink model to an FMU was a good way to hide the model and protect intellectual property.<br \/>\nThe answer is: No!<br \/>\nAn FMU is... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2019\/05\/16\/projects-export-profile\/\">read more >><\/a><\/p>\n","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[66,24,33],"tags":[571,573],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/8890"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=8890"}],"version-history":[{"count":14,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/8890\/revisions"}],"predecessor-version":[{"id":8957,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/8890\/revisions\/8957"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=8890"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=8890"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=8890"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}