将 F:\admin\stress-strain\ 修改为自己文件夹位置
默认导入txt,其余格式文件小修即可
clc;clear
path = 'F:\admin\stress-strain\';
namelist = dir([path,'*.txt']);
% namelist = dir([path,'*.xls']);
L = length(namelist);
a = cell(1,L);
for i = 1:L
filename{i} = [path,namelist(i).name];
a{1,i} = load(filename{i});%读取txt文件
% a{1,i} = xlsread(filename{i});%读取excel文件
namelist(i).name;
end
data1=a';
data2=cell2mat(data1);%由元胞数组转化为矩阵