필터 지우기
필터 지우기

Operator '-' is not supported for operands of type 'timetable'.

조회 수: 14 (최근 30일)
Nassim CHERIF
Nassim CHERIF 2022년 3월 31일
답변: Cris LaPierre 2022년 3월 31일
Operator '-' is not supported for operands of type 'timetable'.
Error in kppvg (line 23)
dist = sum((repmat(vc(i,:),nb_vD,1)-D).^2,2);%calcul dist^2
Error in main (line 53)
[ind_vp,dist_vp,c]=kppvg(X,Xtest,u(i),[1 2 3 4 5]);
hello, i have this problem when i excute my KNN program please can anyone help me :(

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 3월 31일
A timetable holds several variables of different data types. You must specify which variable in your timetable you want to subtract from.
See this page on how to Access Data in Tables
% Create the timetable
MeasurementTime = datetime({'2015-12-18 08:03:05';'2015-12-18 10:03:17';'2015-12-18 12:03:13'});
Temp = [37.3;39.1;42.3];
Pressure = [30.1;30.03;29.9];
WindSpeed = [13.4;6.5;7.3];
TT = timetable(MeasurementTime,Temp,Pressure,WindSpeed)
TT = 3×3 timetable
MeasurementTime Temp Pressure WindSpeed ____________________ ____ ________ _________ 18-Dec-2015 08:03:05 37.3 30.1 13.4 18-Dec-2015 10:03:17 39.1 30.03 6.5 18-Dec-2015 12:03:13 42.3 29.9 7.3
% Subtract from a variable in timetable TT
TT.Temp - 5
ans = 3×1
32.3000 34.1000 37.3000
% Your error - subtract from timetable TT
TT - 5
Operator '-' is not supported for operands of type 'timetable'.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by