How to close a .mat file
38 次查看(过去 30 天)
显示 更早的评论
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
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 .
回答(2 个)
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 个评论
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!