简体   繁体   中英

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. I ran the profiler on open filename.m and this is what I see:

档案信息

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?

I'm interested to hear if there's a solution. The delay is getting on my nerves.

Use edit filename.m instead. It doesn't invoke VideoReader and is more than 10 times as fast.

It seems that editing finfo() seems to solve the problem. If you do not have permissions to edit the original file, just place the modified copy somewhere and add it to MATLAB's path.

The modified finfo() has the following lines (starting at line 56 in the version I have). The only change is dealing with .m files is done prior and instead all the video/audio handling:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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