首页 > 其他分享 >MATLAB 时间读取变为向量格式效率对比

MATLAB 时间读取变为向量格式效率对比

时间:2022-08-31 10:33:31浏览次数:55  
标签:Cell dm 读取 da --- MATLAB time Dataori 向量

% --- 数据时间读取1 --- % 测试时间:39s
%tic
Dataori_time = Cell_ss(:,1);
da_time = zeros(length(Cell_ss),6);
for j = 1:length(Dataori_time)
  dm_time = Dataori_time{j,1};
  %-- 时间信息是 年-月-日-小时-分钟-0
  da_time(j,:) = datevec(dm_time);
end
toc

 

% --- 数据时间读取2 --- % 测试时间2:6s
tic
Dataori_time = Cell_ss(:,1);
da_time = zeros(length(Cell_ss),6);
dm_time_D = datestr(Dataori_time(:,1),'dd-mmm-yyyy HH:MM:SS');
dm_time_E = cellstr(dm_time_D);
for j = 1:length(Dataori_time)
  %-- 时间信息是 年-月-日-小时-分钟-0
  da_time(j,:) = DateConvert(dm_time_E{j}, 'vector');
end
toc

% --- 数据时间读取3 --- % 测试时间2:5s
Dataori_time = Cell_ss(:,1);
da_time = zeros(length(Cell_ss),6);
dm_time_D = datenum(Dataori_time(:,1));
[year, month, day, hour, minute, second] = datevecmx(dm_time_D);
da_time(:,1:6) = [year, month, day, hour, minute, second];

标签:Cell,dm,读取,da,---,MATLAB,time,Dataori,向量
From: https://www.cnblogs.com/ctt0601/p/16642111.html

相关文章