jstm88
jstm88

Reputation: 3365

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:

Profile information

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.

Upvotes: 3

Views: 1811

Answers (2)

user3007866
user3007866

Reputation: 31

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.

Upvotes: 3

Bull
Bull

Reputation: 11951

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

Upvotes: 4

Related Questions