choose_path_and_file.m

来自「用于自定义文件的路径和分类显示特定类型的文件菜单」· M 代码 · 共 23 行

M
23
字号
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % A very useful menu generator for a certain type of files
 % By using this program, you can choose the path, and the file you want to
 % run. 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

path = uigetdir;% Choose path
  string = [path '\'];% 
  dirname = string;
dir_names = what(dirname);% find all the files under the certain path
matfiles = dir_names.mat;%choose all the MAT files
Savedname=[]


cd (dirname)% enter the path
INPUT1 = menu('Please select your .mat file', matfiles{1:end}, 'CANCEL');% show the mat files menu
 if INPUT1 ~= (length(matfiles) + 1) % if the customer not equal to the "Cancel", the system will choose the run the selected files.
            Filename = matfiles{INPUT1};
          disp('#############################################');
            disp(['Begin to load ' Filename ' into workspace...']);
        else
            close all; % if choose to cancel the file, the system will be closed
 end

⌨️ 快捷键说明

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