Manage Files and Folders - MATLAB & Simulink (original) (raw)

This table shows how to create, open, move, and rename files and folders on local and network drives from the toolstrip and the Files panel. To open the Files panel, click the Files icon in the sidebar. If you have MATLAB Connector installed on your system, you also can access files and folders in your MATLAB® Drive™ from MATLAB.

Action Tools Workflow Function Alternative
Create a new folder In the Files panel, right-click in white space, and then select > . Alternatively, on the Home tab, select > .MATLAB creates and selects a folder named New Folder in the current folder. Use the mkdir function. For example, create a subfolder named newdir in a parent folder named parentFolder:mkdir('parentFolder','newdir');
Move a file or folder In the Files panel click and drag the item. You cannot move a folder while it is on the search path. Use the movefile function. For example, move the file named myfile.m in the current folder to the folder,d:/work:movefile('myfile.m','d:/work');
Rename a file or folder In the Files panel, right-click the item and select . Alternatively, pressF2. On macOS press Enter instead.File names must start with a letter, and can contain letters, digits, or underscores. Use the movefile function. For example, in the current folder, renamemyfile.m tooldfile.m:movefile('myfile.m','oldfile.m');
Open a file in MATLAB On the Home tab, in theFile section, click, and then select a file to open.You also can double-click the file in the Files panel or select the file and press Enter. OnmacOS, press Command+Down Arrow instead.To open a file in the Editor as a text file, even if the file type is associated with another application or tool, in the File section, click > . Use the open function. The file opens in MATLAB or in an external application, depending on the file extension.
Open a file in another program In the Files panel, right-click the file and select . The file opens in the application or tool that the operating system associates with the file type.
Reopen a recently opened file On the Home tab, in theFile section, click, and select a file from theRecent Files section. To reopen a recently opened project, select a project from the Recent Projects list. none
Reopen last closed file On the Home tab, in theFile section, click > . Alternatively, pressCtrl+Shift+T. none
Preview file contents without opening the file In the Files panel, right-click the file and select . You also can click the Preview button to the right of the file or folder name.Files panel with a list of files and the file preview for the lengthofline.m file open none
Preview contents of Markdown file When you open a Markdown file in MATLAB, the Editor shows a preview of the file to the right of the Markdown file. As you make edits to the file, the Editor updates the preview. To close the preview, go to theView tab and in thePreview section, click the Markdown button off. In the preview, Markdown and MATLAB code appears with syntax highlighting. The Editor does not render images from external web pages in the preview. none
Delete a file or folder In the Files panel, select the file or folder and pressDelete.By default, MATLAB deletes or recycles files and folders according to your operating system settings. To permanently remove the selection when the system setting is set to recycle, pressShift+Delete.On Linux® systems, you can request that MATLAB move deleted files to a temporary folder. On theHome tab, in theEnvironment section, click Settings. Select > and modify the Deleting files setting. To delete a file, use the delete function. For example, delete a file named myfile.m in the current folder:delete('myfile.m');By default, files are permanently removed. To move deleted files to a temporary folder instead, use the recycle function or set the Deleting files setting.To delete a folder, use the rmdir function. You cannot recover folders deleted usingrmdir.
View MATLAB Drive recent activity In the Files panel, right-click any MATLAB Drive file or folder and select > . none
Open MATLAB Drive online In the Files panel, right-click any MATLAB Drive file or folder and select > . none

Manage Files and Folders in MATLAB Online

MATLAB Online™ provides access to MATLAB from a standard web browser. In MATLAB Online, you only have access to the files and folders in your MATLAB Drive, and some file actions are not supported.

For more information about how to access files in MATLAB Online, see Access Files in MATLAB Online.

See Also

edit | mkdir | open | movefile | rmdir | delete | recycle

Topics