How to close .m script file in GUI with a push button?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
OK
el 19 de Ag. de 2019
Comentada: OK
el 20 de Ag. de 2019
How to close .m script file in GUI with a push button?
0 comentarios
Respuesta aceptada
Walter Roberson
el 20 de Ag. de 2019
Editada: Walter Roberson
el 20 de Ag. de 2019
allEditors = matlab.desktop.editor.getAll;
Now match the filename you want to close against {allEditors.Filename} to figure out the index of the session you want to close. For example,
filenames = regexp({allEditors.Filename}, '[^/\\]+$', 'match','once');
[found, idx] = ismember(FilenameToClose, filenames);
if found
allEditors(idx).close();
end
Except that you need to be more careful than this because there can be multiple files with the same last part of the file name, distinguished by directory.
Más respuestas (0)
Ver también
Categorías
Más información sobre File Operations 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!