How to close a .mat file

Hello!
When loading a "*.mat" file i simply use load('foo.mat'), how can i close this file after loading it?
Thank you

2 Kommentare

jacky chen
jacky chen am 16 Jan. 2014
it's a good question ,you maybe can load the *.mat in a subprogram, then you can return the variable and know which variable is in the *.mat, then use clear to delete them .
Nathanael
Nathanael am 16 Jan. 2014
Thank you! Is it possible to create a blank mat file? Without loading the varibles in the workspace with it?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Friedrich
Friedrich am 16 Jan. 2014

0 Stimmen

The load command should do that automatically. Load open the file, reads the data and closes the file aftwards. So there is no need for your to close it.

2 Kommentare

jacky chen
jacky chen am 16 Jan. 2014
he maybe just wants to delete the variable from load..
In that case use
struct_name = load('foo.mat');
and refer to struct_name.VARIABLENAME instead of VARIABLENAME . Then
clear struct_name
to get rid of them all.

Melden Sie sich an, um zu kommentieren.

Li GMA
Li GMA am 14 Aug. 2019

0 Stimmen

Also there is a button in the top panel, "Clear Workspace".

Kategorien

Gefragt:

am 16 Jan. 2014

Beantwortet:

am 14 Aug. 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by