MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Open and Save Files in the Editor


In this section...
“Open Existing Files” on page 24-2
“Save Files” on page 24-3

Open Existing Files


To open an existing file or files in the Editor, choose the option that achieves your goals,
as described in this table.

Goal Steps Additional Information
Open with associated
tool

Open a file using the
appropriate MATLAB tool
for the file type.

On the Editor, Live Editor, or Home

tab, in the File section, click.

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

For example, this option
opens a file with a .m or .mlx
extension in the Editor and
loads a MAT-file into the
Workspace browser.

Open as text file

Open a file in the Editor as
a text file, even if the file
type is associated with
another application or tool.

On the Editor tab, in the File section,
click Open , and select Open as Text.

This is useful, for example, if
you have imported a tab-
delimited data file (.dat) into
the workspace and you find
you want to add a data point.
Open the file as text in the
Editor, make your addition,
and then save the file.
Open function from
within file

Open a local function or
function file from within a
file in the Editor.

Position the cursor on the name within
the open file, and then right-click and
select Open file-name from the
context menu.

You also can use this method
to open a variable or Simulink
model.

For details, see “Open a File
or Variable from Within a
File” on page 24-37.

24 Coding and Productivity Tips

Free download pdf