简体   繁体   English

MATLAB很慢打开文件进行编辑

[英]MATLAB slow to open files for editing

I'm on r2013a on Mac OS 10.8.3, and I'm noticing very slow performance when opening a .m file for editing. 我在Mac OS 10.8.3上使用r2013a,在打开.m文件进行编辑时,我注意到性能非常慢。 I ran the profiler on open filename.m and this is what I see: 我在open filename.m上运行了探查器,这就是我所看到的:

档案信息

WHAT is it doing trying to read it as a video file? 它试图将其作为视频文件读取是什么? Couldn't it check the extension first? 无法先检查扩展名吗? It's a .m file, why even bother checking if it's a video? 这是一个.m文件,为什么还要费心检查它是否是一个视频?

I'm interested to hear if there's a solution. 我很想知道是否有解决方案。 The delay is getting on my nerves. 延迟让我感到紧张。

Use edit filename.m instead. 请改用edit filename.m It doesn't invoke VideoReader and is more than 10 times as fast. 它不会调用VideoReader,速度提高10倍以上。

It seems that editing finfo() seems to solve the problem. 似乎编辑finfo()似乎解决了这个问题。 If you do not have permissions to edit the original file, just place the modified copy somewhere and add it to MATLAB's path. 如果您没有编辑原始文件的权限,只需将修改后的副本放在某处并将其添加到MATLAB的路径中。

The modified finfo() has the following lines (starting at line 56 in the version I have). 修改后的finfo()具有以下行(从我的版本中的第56行开始)。 The only change is dealing with .m files is done prior and instead all the video/audio handling: 唯一的变化是处理.m文件是事先完成的,而不是所有的视频/音频处理:

if ~isempty(ext)
    if any(strcmp(ext, {'m'}))
        % try to find handler on the path
        openAction = which(['open' ext]);
        loadAction = which([ext 'read']);
    else

        % Get the list of supported video file formats on this platform
        try
            videoFileFormats = VideoReader.getFileFormats;
            % extracting video file extensions
            videoFileExt = {videoFileFormats.Extension};
...
...
...
end %(line 134)

Now opening .m files either from the current folder panel or the command window open() works fast. 现在从当前文件夹面板或命令窗口open()打开.m文件可以快速运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM