How to close a .mat file

34 ビュー (過去 30 日間)
Nathanael
Nathanael 2014 年 1 月 16 日
回答済み: Li GMA 2019 年 8 月 14 日
Hello!
When loading a "*.mat" file i simply use load('foo.mat'), how can i close this file after loading it?
Thank you
  2 件のコメント
jacky chen
jacky chen 2014 年 1 月 16 日
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 2014 年 1 月 16 日
Thank you! Is it possible to create a blank mat file? Without loading the varibles in the workspace with it?

サインインしてコメントする。

回答 (2 件)

Friedrich
Friedrich 2014 年 1 月 16 日
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 件のコメント
jacky chen
jacky chen 2014 年 1 月 16 日
he maybe just wants to delete the variable from load..
Walter Roberson
Walter Roberson 2014 年 1 月 16 日
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.

サインインしてコメントする。


Li GMA
Li GMA 2019 年 8 月 14 日
Also there is a button in the top panel, "Clear Workspace".

カテゴリ

Help Center および File ExchangeVariables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by