comparing datetime from two different files
Hello,
I have 1 mat file called tempo_u1300processo that has times, from with 1 minute of frequency like 01/01/2016 00:00:00, 01/01/2016 00:01:00, etc. In u1200lab(:,1) I got also times, but in the frequency of days: 01/01/2016 04:30:00, 03/01/2016 4:30:00, etc.
The goal of my for loops is to check the times from the 2, in order to create a u1200lab table with a frequency of minutes and to place the value of the variables in front.
This works "fine", but it takes me for my calculation 7 hours to do for 1 variable because the month of January takes 2min, February 4 min (Jan + 2 min), mars 6 min (Jan + Feb + 2), April 8 minutes (Jan Feb Mars + 2min). So i think when starting May, it will do again January February mars April and just may after.
So my question is how to make him not do the months that are already done.
Thanks for your time.
clear; clc; close all; %% ------------------------------------------------------------------------ %% Data Loading - Lab1200 + Lab1300 + Processo1300 load('u1200lab.mat'); load('u1300lab.mat'); load('u1300processo.mat'); load('tempo_u1300processo.mat'); variavel_u1300processo = u1300processo{:,2:end}; %% ------------------------------------------------------------------------ %% Laboratório 1200 [n1200,m1200] = size(u1200lab); ind_aux1200 = []; nvar1200 = m1200/2; for j = 1:nvar1200 % Para os dados de Lab da 1200 for i = 1:length(tempo_u1300processo) ind_aux1200 = find(u1200lab{:,2*j-1}==tempo_u1300processo(i,1)); if ~isempty(ind_aux1200) tempo_u1200lab(i,j) = tempo_u1300processo(i,1) variavel_u1200lab(i,j) = u1200lab(ind_aux1200,2*j); else % Não existe registo para o tempo_processo(i) tempo_u1200lab(i,j) = tempo_u1300processo(i,1); variavel_u1200lab{i,j} = NaN; end ind_aux1200=[]; end num_pontos1200(:,j) = sum(~isnan(variavel_u1200lab{:,j})); Pergunta1(1,j) = isequal(tempo_u1200lab(:,j),tempo_u1300processo) end
2 Comments
Answers (1)
3 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!