How to close a .mat file
34 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello!
When loading a "*.mat" file i simply use load('foo.mat'), how can i close this file after loading it?
Thank you
2 comentarios
jacky chen
el 16 de En. de 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 .
Respuestas (2)
Friedrich
el 16 de En. de 2014
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 comentarios
Walter Roberson
el 16 de En. de 2014
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
el 14 de Ag. de 2019
Also there is a button in the top panel, "Clear Workspace".
0 comentarios
Ver también
Categorías
Más información sobre Variables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!