Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 215038

Submitted on 9 Mar 2013 by Alex P.

Correct

155Size
Leading solution size is 71.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%% count files subdirectories
files = subdir(fullfile(matlabroot,'java'));
assert(numel(files)>=595 & isfield(files,'name'))

                    
2
Pass
 
%% count text files
files = subdir(fullfile(matlabroot,'*.txt'));
[~,~,ext]=cellfun(@fileparts,{files.name},'UniformOutput',false);
assert(numel(files)>=209 & isfield(files,'name') & all(strcmp(ext,'.txt')))

                    
3
Pass
 
%%
files = subdir(fullfile(matlabroot,'toolbox','*.m'));
[~,~,ext] = cellfun(@fileparts,{files.name},'UniformOutput',false);
assert(numel(files)>=15060 & isfield(files,'name') & all(strcmp(ext,'.m')))