%% SEARCH Searches a folderpath and returns a list of matching filetype
% This function works only on windows machines. This is a demostration of
% how System.IO namespace can be used in MATLAB.
% filetype: file type sought after. Argument permitted can be any file type
% on windows machine e.g. '*.xls','*.m' : Use '*.*' to return all file
% folderpath: folder path to look for matching filetypes e.g 'C:\windows' ;
% note however that u much have search permission on the folder you intend
% to search.
anthony bobbie (2020). Search( filetype,folderpath) (https://www.mathworks.com/matlabcentral/fileexchange/49922-search-filetype-folderpath), MATLAB Central File Exchange. Retrieved .
The message 'file type cannot be empty' does not match the test "exist(folderpath, 'dir')==7".
There is a problem with the indexing: The last element of the output is empty. Why does the FOR loop end at "file_count-1" and not "file_count"? You need the 1-based indices in the Matlab cell, but a 0-based index for the .NET array:
for x = 1:file_count
There is no need to limit the file specifier to start with '*.' .