close关闭指定窗口 matlab_如何从Matlab命令提示符下关闭一个或所有当前打开的Matlab(* .m)文件?...

在Windows 7上使用Matlab R2013a时,发现旧的`com.mathworks.mlservices.MLEditorServices.closeAll`方法不再适用。现在,可以通过获取MLEditorServices的编辑器应用程序并调用`close`或`closeNoPrompt`方法来关闭所有或不保存所有编辑器窗口。此外,可以获取打开的编辑器对象列表,通过结构体存储,并使用这些对象逐个控制编辑器窗口,例如关闭特定文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I found a solution on the web (see below, circa 2009) which does not work on my machine (Windows 7, Matlab R2013a):

Editor = com.mathworks.mlservices.MLEditorServices;

Editor.closeAll;

解决方案

As you noticed, newer versions of Matlab do not return the same type of Java object for the editor.

The main editor service can still be accessed with the same command as before:

edtSvc = com.mathworks.mlservices.MLEditorServices ; %// get the main editor service ;

But this only return the handle of the service, not individual editor.

As answered by Daniel, you can close the full service from there, which will close all the editors at once. You can use one of the 2 methods available:

edtSvc.getEditorApplication.close ; %// Close all editor windows. Prompt to save if necessary.

edtSvc.getEditorApplication.closeNoPrompt ; %// Close all editor wind

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值