Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %0= aktif
- %1= uyanik
- %2= uyku
- %Baslangic saati %Bitis saati %Kod
- cell_in ={
- '2021-03-21 07:00', '2021-03-21 10:15', 0
- '2021-03-21 10:15', '2021-03-21 10:30', 1
- '2021-03-21 10:30', '2021-03-21 12:00', 2
- '2021-03-21 12:00', '2021-03-21 15:00', 0
- '2021-03-21 15:00', '2021-03-21 15:10', 1
- '2021-03-21 15:10', '2021-03-21 16:15', 2
- '2021-03-21 16:15', '2021-03-21 20:00', 0
- '2021-03-21 20:00', '2021-03-21 21:45', 1
- '2021-03-21 21:45', '2021-03-22 01:20', 2
- '2021-03-22 01:20', '2021-03-22 03:00', 1
- '2021-03-22 03:00', '2021-03-22 07:00', 2
- %%
- '2021-03-22 07:00', '2021-03-22 10:15', 0
- '2021-03-22 10:15', '2021-03-22 10:30', 1
- '2021-03-22 10:30', '2021-03-22 12:00', 2
- '2021-03-22 12:00', '2021-03-22 15:00', 0
- '2021-03-22 15:00', '2021-03-22 15:10', 1
- '2021-03-22 15:10', '2021-03-22 16:15', 2
- '2021-03-22 16:15', '2021-03-22 20:00', 0
- '2021-03-22 20:00', '2021-03-22 21:45', 1
- '2021-03-22 21:45', '2021-03-23 01:20', 2
- '2021-03-23 01:20', '2021-03-23 03:00', 1
- '2021-03-23 03:00', '2021-03-23 07:00', 2
- };
- mat_in = nan(size(cell_in));
- mat_in(:,1) = datenum(cell_in(:,1),'yyyy-mm-dd HH:MM');
- mat_in(:,2) = datenum(cell_in(:,2),'yyyy-mm-dd HH:MM');
- mat_in(:,3) = cell2mat(cell_in(:,3));
- mat_in = sortrows(mat_in,1);
- mat_in(:,1:2) = mat_in(:,1:2)-7/24;
- MIN_DT = floor(min(mat_in(:,1)));
- MAX_DT = floor(max(mat_in(:,1)));
- TIME_smp = 1; %in minutes
- timeVec = 0:TIME_smp/(24*60):1;
- dtVec = MIN_DT:MAX_DT;
- N_t = numel(timeVec);
- N_d = numel(dtVec);
- checkMat = nan(N_d,N_t);
- [ir,ic] = ind2sub([N_d N_t],find(isnan(checkMat)));
- linT = dtVec(ir) + timeVec(ic) ;
- for i=1:size(mat_in,1)
- idSel = linT>mat_in(i,1) & linT<mat_in(i,2);
- checkMat(idSel) = mat_in(i,3);
- end
- figure;
- imagesc(checkMat);
- %set(gca,'yticklabel',{'12 araliik',' bok',})
- set(gca,'ytick',[1 2]);
- set(gca,'xtick',[0:24]*60/TIME_smp + TIME_smp)
- set(gca,'xticklabel',[0:24])
- set(gca,'xticklabel',[7:24 0:6])
- colormap([1 0 0; 0 0 1; 0 1 0;]);
- pbaspect([6 1 1]);
- colorbar;
- grid on;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement