Matlab gets all Excel file names in the current folder and prints them

Matlab gets all Excel file names in the current folder and prints them

1. Run the program and the results are as follows.

Insert picture description here

2. Source code

clear,clc
tic
xls_list = dir('*.xlsx');                            %   获取所有原始xls文件
xls_num = length(xls_list);                         %   xls文件总数量
xls_names=cell(xls_num,1);                          %   所有xls文件名称,含后缀名。
disp('所有xlsx文件名称依次为:');
for batch_i=1:xls_num    
	xls_names{batch_i}=xls_list(batch_i).name;
	fprintf('%2d %s\n',batch_i,xls_list(batch_i).name);          %   显示所有xls文件名称        
end
clear xls_list
time_batch_eachs=zeros(xls_num,1);
warndlg('          任务完成!',' ');

Guess you like

Origin blog.csdn.net/peter_young1990/article/details/114412012