Manage Files and Folders - MATLAB & Simulink - MathWorks Deutschland (2024)

Main Content

Manage Files and Folders

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

ActionTools WorkflowFunction Alternative
Create a new folder

In the Current Folder browser, right-click in white space, and then select New > Folder.

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 Current Folder browser, 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 Current Folder browser, right-click the item and select Rename.

File names must start with a letter, and can contain letters, digits, or underscores.

Use the movefile function. For example, in the current folder, rename myfile.m to oldfile.m:

movefile('myfile.m','oldfile.m');
Open a file in MATLAB

On the Home tab, in the File section, click Open Manage Files and Folders- MATLAB & Simulink- MathWorks Deutschland (1), and then select a file to open.

You also can double-click the file in the Current Folder browser.

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 Open > Open as Text.

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 Current Folder browser, right-click the file and select Open Outside MATLAB. 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 the File section, click Open Manage Files and Folders- MATLAB & Simulink- MathWorks Deutschland (2), and select a file from the Recent Files section. To reopen a recently opened project, select a project from the Recent Projects list.

none
Preview file contents without opening the file

In the Current Folder browser, right-click the file and select Show Details. The Details Panel expands.

Not supported for live scripts and functions.

none
Delete a file or folder

In the Current Folder browser, select the file or folder and press Delete.

By default, MATLAB deletes or recycles files and folders according to your operating system preferences. To permanently remove the selection when the system preference is set to recycle, press Shift+Delete.

On Linux® systems, you can request that MATLAB move deleted files to a temporary folder by setting the Deleting files preference. Access this preference on the Home tab, in the Environment section, by clicking Manage Files and Folders- MATLAB & Simulink- MathWorks Deutschland (3) Preferences. Select MATLAB > General.

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 preference.

To delete a folder, use the rmdir function.

Note

You cannot recover folders deleted using rmdir.

View MATLAB Drive recent activity

In the Current Folder browser, right-click any MATLAB Drive file or folder and select MATLAB Drive > View Recent Activity....

none
Open MATLAB Drive online

In the Current Folder browser, right-click any MATLAB Drive file or folder and select MATLAB Drive > Go to MATLAB Drive Online....

none

To open the Current Folder browser if it is not visible, go to the Home tab, and in the Environment section, click Layout. Then, under Show, select Current Folder. Double-clicking a subfolder displays its contents, and makes that folder the current folder.

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

Related Topics

  • Save and Back Up Code
  • Save and Load Workspace Variables
  • Errors When Updating Folders on Search Path
  • Access Files in MATLAB Online
  • Share Folders Using MATLAB Drive

MATLAB-Befehl

Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:

 

Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.

Manage Files and Folders- MATLAB & Simulink- MathWorks Deutschland (4)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Manage Files and Folders
- MATLAB & Simulink
- MathWorks Deutschland (2024)

FAQs

How do I Delete files and folders in MATLAB? ›

In the Current Folder browser, select the file or folder and press Delete. By default, MATLAB deletes or recycles files and folders according to your operating system preferences.

How do I open the file Manager in MATLAB? ›

Open the Current Folder Browser

In MATLAB Online™, the Current Folder browser is called the Files panel. To show or hide the Files panel, click its icon in the sidebar. To open the Files panel if it is not currently in the left or right sidebar, go to the Home tab, and in the Environment section, click Layout.

How do you list all the folders and files inside the current directory in MATLAB? ›

dir lists files and folders in the current folder. dir name lists files and folders that match name . When name is a folder, dir lists the contents of the folder.

How to change MATLAB file directory? ›

You can set the initial working folder in MATLAB through the following Preference settings:
  1. Open the Preferences window.
  2. Navigate to the General options.
  3. Select the option to specify a path to a folder under the Initial working folder options, and enter the desired directory.
  4. Press Apply and/or OK to save your changes.
Oct 11, 2012

How do I permanently delete files in MATLAB? ›

By default, the specified file is permanently deleted. To change whether the file is permanently deleted or sent to the recycle folder, go to the Home tab, and in the Environment section, click Preferences. Select MATLAB > General and in the Deleting files section, select from the available options.

How to remove folder and subfolders from path in MATLAB? ›

Remove a Folder from the Project Path
  1. openExample("matlab/TimesTableProjectExample") proj = currentProject;
  2. folderpath = fullfile(proj. RootFolder,"folder"); mkdir(filepath);
  3. projectFile = addFile(proj,folderpath);
  4. folderpath = addPath(proj,folderpath);
  5. removePath(proj,folderpath)

How do I open Simulink files in MATLAB? ›

To open the Simulink Start Page, in the MATLAB Toolstrip, click Simulink. On the Start Page, click the title of a template to expand the description. Click the down arrow next to Create Model and select Set As Default.

How do I access a folder in MATLAB? ›

To open the Current Folder browser if it is not visible, go to the Home tab, and in the Environment section, click Layout. Then, under Show, select Current Folder. Double-clicking a subfolder displays its contents, and makes that folder the current folder.

How do I access my MATLAB drive files? ›

If the MATLAB Drive button is not on the Current Folder toolbar, you can add it by right-clicking the toolbar and selecting Customize. Then, in the MATLAB Toolbar Preferences Controls section, select Access MATLAB Drive files on this computer and click OK.

How do you check if a file exists in MATLAB? ›

To check the existence of a file or folder, you also can use the isfolder or isfile functions. exist searches for files and folders on the search path, which can lead to unexpected results.

What is the current folder in MATLAB? ›

The current folder is a reference location that MATLAB uses to find files. This folder is sometimes referred to as the current directory, current working folder, or present working directory.

How to add all folders in current directory to path MATLAB? ›

Use genpath with addpath to add all subfolders of folderName . MATLAB resolves all path names containing ' . ', ' .. ', and symbolic links to their target location before adding them to the path. This ensures that each entry in the MATLAB path represents a unique folder location.

How do you navigate folders in MATLAB? ›

You can navigate through your MATLAB Drive™ using the breadcrumb. To change the current working folder while using the command line, enter the cd command with the folder name you want to switch to.

Where is my MATLAB directory? ›

The default userpath folder is platform-specific. Windows® platforms — %USERPROFILE%/Documents/MATLAB . Mac platforms — $home/Documents/MATLAB .

How to clear data in MATLAB? ›

To clear all variables from the current workspace, use clear or clearvars . To clear all global variables, use clear global or clearvars –global .

How do I delete a file in MATLAB source control? ›

Removing Files from the Source Control System
  1. In the MATLAB Current Folder browser, select the files you want to remove.
  2. Right-click, and from the context menu, select Source Control > Remove from Source Control. The MATLAB Remove from source control dialog box opens, listing the files you selected.
  3. Click OK.

How do I remove a file from a project in MATLAB? ›

In the Files view, right-click the file, and then select Remove from Project. To remove a file programmatically, use the removeFile function. Move project files or folders. Cut and paste or drag the files in the project.

How to delete a folder and subfolders and files in command prompt? ›

To remove a directory and all its contents, including any subdirectories and files, use the rm command with the recursive option, -r . Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -r command.

Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 5245

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.