Filter löschen
Filter löschen

Is there a way to convert table columns and terms into regular numbers?

2 Ansichten (letzte 30 Tage)
Jingyu Yang
Jingyu Yang am 22 Aug. 2020
Beantwortet: Steven Lord am 22 Aug. 2020
I made Table set from excel file.
Timeline = readtable('Timeline.xlsx');
Lidar_DeltaT = Timeline(2, 6);
Lidar_Distance= readtimetable('Lidar Cycle.txt');
summary(Lidar_Distance);
Lidar_Distance.Time = Lidar_Distance.Time + seconds(Lidar_DeltaT);
Timeline(2, 6)'s number value is 1
I want to make
"Lidar_Distance.Time = Lidar_Distance.Time + seconds(Lidar_DeltaT);"
line has same meaning of the line
"Lidar_Distance.Time = Lidar_Distance.Time + seconds(1);"
But It occurs an error. What should I do?

Antworten (1)

Steven Lord
Steven Lord am 22 Aug. 2020
You haven't showed us the text of the error, but I'm guessing it was:
Error using seconds (line 19)
Input data must be a real, numeric array.
Using parentheses to index into a table array (like Timeline) returns a smaller table.
Using curly braces to index into a table array returns the contents of those elements of the table.
Using dot to retrieve a variable from a table array returns the contents of that variable.
t = table(123)
s1 = seconds(t(1, 1)) % Throws an error
s2 = seconds(t{1, 1}) % Works
s3 = seconds(t.Var1) % Also works
If that's not the text of the error, please show the full and exact text of the error (all the text displayed in red in the Command Window.)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by