⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getfile.m

📁 matlab处理图像的一些基本方法。其中有一部分mex程序需要安装编译
💻 M
字号:
function [flist, pathname] = getfiles(filefilter)
% GETFILE Retrieve the filelist and the pathname.
%
%        [FILELIST, PATHNAME] = GETFILE('filterSpec')
%
%        The filterSpec parameter determines the files to be retrieve.
%        Default is '*.mat'.
%        For example '/usr/mfile/*.m' retrieves all the MATLAB M-files
%        in the directory /usr/mfile
%        The output parameter FILELIST is a matrix containing the name of the
%        files found in the path. The number of rows of the matrix correspond
%        to the number of files found, the number of columns is the length
%        of the longest filename found. The sorter filenames are filled
%        with zeros.
%        The output parameter PATHNAME is a string containing the path of
%        the files found.
%
%        See also UIGETFILE, UIPUTFILE.

%
% Copyright (c) 1995 by Claudio Rivetti and Mark Young
% claudio@alice.uoregon.edu,    mark@alice.uoregon.edu
%



if nargin > 1
  error('Too many input arguments');
end

if nargin < 1
  filefilter = '*.mat';
end

command=['ls -1 ' filefilter];
[ok,list]=unix(command);

if ok~=0
  error(['Error executing command: ' command]);
end

flist=[];

while 1
  [string,list]=strtok(list, setstr(10));
    if isempty(string), break, end
  len = length(string);
  p=max(find(string=='/'));
  if isempty(p), p=0; end
  flist=str2mat(flist,string(p+1:len));
end

p=max(find(filefilter=='/'));

if ~isempty(flist)
  flist=flist(2:size(flist,1),:);
  if isempty(p)
    pathname=[pwd '/'];
  else
    pathname=filefilter(1:p);
  end
end

return

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -