Comments on: Creating a Utility to Close All MATLAB Base Functions Open in the Editor https://blogs.mathworks.com/videos/2016/04/20/creating-a-utility-to-close-all-open-files-in-the-matlab-editor-under-matlabroot/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Mon, 23 May 2016 17:44:51 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Jan https://blogs.mathworks.com/videos/2016/04/20/creating-a-utility-to-close-all-open-files-in-the-matlab-editor-under-matlabroot/#comment-61313 Wed, 20 Apr 2016 19:51:33 +0000 https://blogs.mathworks.com/videos/?p=2217#comment-61313 Ha, got the same function, but under the name strscmp :D
I believe it’s the curse of prosperity. Matlab built-in functions base grows and grows, and we forget about the functions we used yesterday. That’s the reason I appreciate the documentation so much.

]]>
By: Stuart McGarrity https://blogs.mathworks.com/videos/2016/04/20/creating-a-utility-to-close-all-open-files-in-the-matlab-editor-under-matlabroot/#comment-61312 Wed, 20 Apr 2016 19:24:04 +0000 https://blogs.mathworks.com/videos/?p=2217#comment-61312 Hi Jan,
Yes, strncmp would be better. I had forgotten about that function. I often use it in another utility function:

function result= startswith(x,y)
result = strncmp(x,y,length(y)); % true if x=[y, ‘***’],
end

]]>
By: Jan https://blogs.mathworks.com/videos/2016/04/20/creating-a-utility-to-close-all-open-files-in-the-matlab-editor-under-matlabroot/#comment-61311 Wed, 20 Apr 2016 19:09:06 +0000 https://blogs.mathworks.com/videos/?p=2217#comment-61311 Hi Stuart, thanks for another interesting video. I like the code-along style of your videos, it increases teaching value of those.
One thing that came to my mind is to use “strncmp” instead of “strfind” and “cellfun” in this case, so it would look like:

%% Find Files Under MATLAB Root
found = strncmp(fileNames, matlabroot, length(matlabroot)); % Logical array for matlabroot files

Very useful and simple function. I must admit I would used it, but was too lazy to try to write something like this.

]]>