rri_fileparts.m

来自「绝对经典,老外制作的功能强大的matlab实现PLS_TOOBOX」· M 代码 · 共 28 行

M
28
字号
%------------------------------------------------------------
function [pathname,filename] = rri_fileparts(full_filename)

   r = full_filename;
   o = r;

   %  can not use filesep, because the full_filename string
   %  is imported from a different platform
   %
   %  arch = computer;
   %  ispc = strcmp(arch(1:2),'PC');
   %
   while ~isempty(r)

      if isempty(findstr(r, '/'))
         [filename r] = strtok(r,'\');
      else
         [filename r] = strtok(r,'/');
      end

   end

   r = findstr(o,filename) - 2;		% take out '\' and last char
   pathname = o(1:r(end));

   return;

⌨️ 快捷键说明

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