main content

get started with matlab projects -凯发k8网页登录

this example shows how to use an existing project to manage the files within your design. you can automate startup and shutdown tasks, add shortcuts for common tasks, run checks, upgrade project files, analyze project dependencies, and share your project.

as a design grows, managing referenced files and dependencies becomes more complicated. projects help you organize large hierarchies by finding required files, managing and sharing files and settings, and interacting with source control.

this project example is not under source control. as a result, essential tools needed in a collaborative environment are not available for use, for example, comparing files to their ancestors, comparing revisions, and resolving conflicts.

  • to use available source control integration in matlab® such as git™ and svn, see or .

  • to use an external source control with project, put the project folder under the source control of choice and customize it to use the matlab® comparison tool for diff and merge. for more information, see .

set up example files and open project

create and open a working copy of the project example files. matlab® copies the files to an example folder so that you can edit them.

sldemo_slproject_airframe_setup;
building with 'mingw64 compiler (c)'.
mex completed successfully.

manage project path

when you open your project, matlab adds the project path to the matlab search path before applying startup shortcuts.

when you close your project, matlab removes the project path from the matlab search path after applying shutdown shortcuts.

to add or remove folders to the project path, on the project tab, in the environment section, click project path.

  • to add a folder to the project path, click add folder. if you want to add a folder and its subfolders, click add with subfolders instead. then, use the open dialog box to add the new folder.

  • to remove a folder from the project path, from the display list, select the folder. then, click remove.

you must add project files to the project path to ensure that the dependency analyzer detects all project files.

specify project details, startup folder, and derived files folders

on the project tab, in the environment section, click details. use the project details dialog box to:

  • edit the project name or add a description.

  • view the project root folder. you can change your project root by moving your entire project on your file system, and reopening your project in its new location. all project file paths are stored as relative paths.

  • view or edit the start up folder. by default, this folder is set to the project root. when you open the project, the current working folder changes to the project root folder. you can specify a different startup folder or click clear.

  • view or edit the simulation cache folder and code generation folder.

to change the default project root for new projects, on the matlab home tab, in the environment section, click preferences. select matlab > project and specify the default folder.

automate startup and shutdown tasks

you can set project files, such as matlab scripts and simulink® models, to run, open, or close when the project opens or closes.

to configure an existing file to run on project startup and shutdown, or to specify environment options, click the startup shutdown button in the project tab. in the manage project startup and shutdown dialog box:

  • add or remove startup and shutdown files. you can change the execution order using the arrow buttons.

  • use the check boxes to specify environment options. select start simulink before this project starts to start simulink when you open the project. select refresh simulink customizations to run sl_customization files on project startup and shutdown.

project shortcuts for common tasks

create project shortcuts for common tasks to make it easy to find and access important files and operations. for example, find and open top models, run code, and simulate models.

on the project shortcuts tab, this example project has shortcuts for the top-level model, a utility function to rebuild s-functions, and a design description document.

  • click the shortcut f14 model to open the root model for this project.

  • click the shortcut rebuild project's s-functions to generate the s-function.

  • click the new shortcut button to create new shortcuts for a project file.

  • right-click a shortcut and select edit shortcut to edit a shortcut.

explore files views

in the files view, select the project (number of files) view to manage the files within your project. this view only shows files that are part of your project.

use the all view to see all the files in your working copy. this view shows all the files that are under the project root, not just the files that are in the project. this view is useful for adding files to your project from your working copy.

in any files view, at the top right, change the layout from tree to list to view the files as a list. click organize view to customize the views and to sort files.

analyze project dependencies

use the dependency analyzer to investigate dependencies visually and explore the structure of your project. on the project tab, click the down arrow to expand the tools gallery. under apps, click dependency analyzer.

the dependency analyzer summarizes the results in the pane on the right. it lists the names of the used products and add-ons. it detects problems, such as missing files, files not in the project, unsaved changes, and out-of-date derived files. in this example, the analyzer identifies a file not in project and tags it with a warning sign .

to highlight problem files, in the problems section, point to the problem message and click the magnifying glass. in this example, the timesthree.mexw64 file is required by the project but is not part of it. right-click timesthree.mexw64 and select add to project or hide warnings. next time you run the dependency analysis, the analyzer will not mark this file as a problem.

perform an impact analysis on a selected file.

an impact analysis shows you how a change affects other files before you make the change. for example, to find required files for timesthree.mexw64 to run properly, right-click timesthree.mexw64 and select find required. to find how changes to timesthree.mexw64 impact files, right-click timesthree.mexw64 and select find impacted.

run checks and upgrade project files

you can easily upgrade all models, libraries, and matlab code files in your project to the latest release. on the project tab, click the down arrow to expand the tools gallery. under project checks, click upgrade project.

to upgrade all files, run all checks, and apply fixes automatically where possible, click upgrade. if you want to change the settings, use these options before clicking upgrade:

  • if you want to run upgrade checks but not apply fixes automatically where possible, clear the check box apply upgrades automatically.

  • if you want to change which files to upgrade and which checks to run, click change options. in the upgrade options dialog box, clear check boxes for models and checks you want to exclude from the upgrade.

the upgrade project tool apply all fixes automatically when possible, upgrade all model hierarchies in the project at once, and produce a report.

share project

before sharing projects with other users, use the dependency analyzer to find required files and products.

on the project tab, select share and explore the different sharing options.

  • share your project as an archive and send it by email. on the project tab, select share > archive.

  • export the whole project or just a part of it using export profile. if you decide to exclude files from your project, use the dependency analyzer to examine the impact of excluding a file on the project.

  • if you have referenced projects and want to export the referenced project files, then select the include referenced projects check box.

you can also share your project and make it publicly available on github® which adds git source control to the open project.

see also

网站地图