Merge a timedate table with a normal table

Hi, I got a timedate table 5x2 and another table 5x2, and I want to place in 1st column the time date and 2nd and 3rd the rest.
Tablenew = [novo_tempo_laboratorio novo_variavel_laboratorio];
The Tablenew gives me an error because the two types of tables that I want to merge are from different types.
load('Processo.mat');
Laboratorio = readtable('Laboratório.xlsx','Sheet','Laboratorio','Range','A1:D3');
save Laboratorio.mat Laboratorio
load('Laboratorio.mat');
tempo_processo = Processo{:,1};
variavel_processo = Processo{:,2};
% tempo_laboratorio = Laboratorio{:,1:2:end};
% variavel_laboratorio = Laboratorio{:,2:2:end};
[n,m] = size(Laboratorio);
ind_aux=[];
A=zeros(length(tempo_processo),1+m/2);
for j = 1:m/2
for i = 1:length(tempo_processo)
ind_aux = find(Laboratorio{:,2*j-1}==tempo_processo(i,1))
if ~isempty(ind_aux)
novo_tempo_laboratorio(i,j) = tempo_processo(i,1);
novo_variavel_laboratorio(i,j) = Laboratorio(ind_aux,2*j);
else % Não existe registo para o tempo_processo(i)
novo_tempo_laboratorio(i,j) = tempo_processo(i,1);
novo_variavel_laboratorio{i,j} = NaN;
end
ind_aux=[];
end
end
Thanks for your time!

댓글 수: 2

See
doc timetable2table
Tiago Dias
Tiago Dias 2018년 2월 8일
편집: Tiago Dias 2018년 2월 8일
Undefined function or variable 'timetable'.
I saw this example but for me i got an error because it says undefined function or variable
Time = datetime({'2015-12-18';'2015-12-19';'2015-12-20'});
Temp = [37.3;39.1;42.3];
Pressure = [29.4;29.6;30.0];
Precip = [0.1;0.9;0.0];
TT = timetable(Time,Temp,Pressure,Precip);
T = timetable2table(TT)

댓글을 달려면 로그인하십시오.

답변 (1개)

Peter Perkins
Peter Perkins 2018년 2월 6일

0 개 추천

You are trying to concatenate a 5x2 datetime array with a 5x2 table. You do not have a timetable and a table. As dpb says, I imagine you want table2timetable, but it's not at all clear what you want to do with two time vectors.

댓글 수: 5

Tiago Dias
Tiago Dias 2018년 2월 6일
i want in the first column of the Table new to place novo_tempo_laboratorio(;,1), and in the others all the novo_variavel_laboratorio
Then probably something like
table2timetablenovo_variavel_laboratorio,'RowTimes',novo_tempo_laboratorio(;,1))
Tiago Dias
Tiago Dias 2018년 2월 8일
편집: Tiago Dias 2018년 2월 8일
try1=table2timetable(novo_variavel_laboratorio,'RowTimes',novo_tempo_laboratorio(:,1));
Undefined function or variable 'table2timetable'.
Guillaume
Guillaume 2018년 2월 8일
You're obviously using a version that predates the introduction of timetables, which require at least R2016b.
Tiago Dias
Tiago Dias 2018년 2월 8일
oh ok, will try on the 2016b, thanks for your input

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Timetables에 대해 자세히 알아보기

태그

질문:

2018년 2월 6일

댓글:

2018년 2월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by