Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab帮助,doc命令非常慢_Matlab - Fatal编程技术网

Matlab帮助,doc命令非常慢

Matlab帮助,doc命令非常慢,matlab,Matlab,我不知道它为什么要这样做,但因为几天的帮助需要很多时间来展示。内联(选择函数,选择“帮助”),或使用命令doc或help。命令doc cmdname显示帮助窗口大约需要10秒钟。我确实这样做了,以fwrite为例,试着打开profile;文件编写;profile viewer并通过兔子洞进行挖掘,我找到了一个私有的java matlab方法,这是一个漫长的过程: tic; com.mathworks.mlwidgets.help.HelpUtils.getDocCommandArg('matla

我不知道它为什么要这样做,但因为几天的帮助需要很多时间来展示。内联(选择函数,选择“帮助”),或使用命令
doc
help
。命令
doc cmdname
显示帮助窗口大约需要10秒钟。我确实这样做了,以
fwrite
为例,试着打开
profile;文件编写;profile viewer
并通过兔子洞进行挖掘,我找到了一个私有的java matlab方法,这是一个漫长的过程:

tic;
com.mathworks.mlwidgets.help.HelpUtils.getDocCommandArg('matlab\fwrite', true);
toc 

Elapsed time is 9.993832 seconds.

知道是什么导致了这个问题吗?它也发生在安全模式下,除了MATLAB没有其他运行程序。我会尝试完全重新安装MATLAB,但如果我可以避免的话,那就太好了。

有几件事可能会导致这个问题,但鉴于您提供的信息,很难确切说明到底发生了什么

R2012b帮助系统初始化时,它会执行一些任务,这些任务有时会导致明显的延迟,主要与确定哪些MathWorks产品可用以及如何设置帮助首选项有关。10秒是不寻常的,但有可能这就是造成延迟的原因。如果您在第一次使用帮助系统时看到性能受到影响,但在同一个MATLAB会话中没有看到,这可能是原因。R2013a改进了此行为

除了初始化任务之外,所讨论的Java调用是一个相对简单的搜索,它与用于搜索文档的搜索索引相同。如果您发现在“帮助浏览器”中搜索文档的速度很慢,这将暗示性能问题存在于“帮助系统”的搜索功能中


在任何一种情况下,你最好的选择可能是。很可能我们可以仔细研究一下,并可能找到某种修复方法。

通过mathworks支持部门的输入,问题已经解决:

>> tic;doc fwrite;toc
Elapsed time is 20.301202 seconds.

>> tic;reader = org.apache.lucene.index.IndexReader.open(fullfile(docroot,'helpsearch'));
searcher = org.apache.lucene.search.IndexSearcher(reader);
term = org.apache.lucene.index.Term('relpath','ref/plot.html');
query = org.apache.lucene.search.TermQuery(term);
hits = searcher.search(query);
fprintf('Found %d results\n', hits.length); searcher.close; reader.close; toc;
Java exception occurred:
java.io.IOException: Lock obtain timed out:
Lock@C:\Users\b\AppData\Local\Temp\lucene-ca3070c312bc20732565936b371a8bd3-     commit.lock
at
org.apache.lucene.store.Lock.obtain(Lock.java:56)
at
org.apache.lucene.store.Lock$With.run(Lock.java:98)
at
org.apache.lucene.index.IndexReader.open(IndexReader.java:141)
at
org.apache.lucene.index.IndexReader.open(IndexReader.java:125)
之后,我认为临时文件被锁定是个问题,于是关闭了Matlab,进入AppData\Local\temp\并清理了其中的所有临时文件

>> tic;
reader = org.apache.lucene.index.IndexReader.open(fullfile(docroot,'helpsearch'));
searcher = org.apache.lucene.search.IndexSearcher(reader);
term = org.apache.lucene.index.Term('relpath','ref/plot.html');
query = org.apache.lucene.search.TermQuery(term);
hits = searcher.search(query);
fprintf('Found %d results\n', hits.length); searcher.close; reader.close; toc;
Found 5 results
Elapsed time is 0.106868 seconds.

>> tic;doc fwrite;toc
Elapsed time is 0.153808 seconds.

要么是清理临时文件,要么是对内部java类org.apache.lucene*的引用起了作用,但现在,doc又快了。

您运行的是哪个Matlab版本?让我猜猜。。。2012b?是的,2012b(准确地说是8.0.0.783)如果你能为Ubuntu推荐类似的东西,它将被证明是最有用的。