필터 지우기
필터 지우기

Convert table into timetable

조회 수: 7 (최근 30일)
Pas
Pas 2022년 6월 8일
댓글: Pas 2022년 6월 8일
Hello,
I would like to import a .csv file and then convert it into a timetable. The first column of my table wich is called "Name" contains the time in Milliseconds. I tried importing the csv file as table, then converting the time into a duration before converting the table to a timetable.
Unfortunately, I am not able to convert my table.
filename = "PATH";
opts = detectImportOptions(filename);
% Specify range and delimiter
opts.DataLines = [10, Inf];
numVariables = length(opts.VariableNames);
opts.VariableTypes = repmat("double", 1 , numVariables);
% Import the data
Import = readtable(filename, opts,'ReadVariableNames',true);
Import.Name = duration(0,0,0,Import.Name);
%% Clear temporary variables
clear opts filename numVariables
Import = table2timetable(Import,'TimeStep','Name');
My table looks like this:
Error using table2timetable (line 75)
Unable to recognize date/time format of 'Name'. Convert text to datetime or duration.
Error in validierung_einlesen_2 (line 27)
Import = table2timetable(Import,'TimeStep','Name');

채택된 답변

Walter Roberson
Walter Roberson 2022년 6월 8일
Import = table2timetable(Import, 'RowTimes', Import.Name);
  댓글 수: 1
Pas
Pas 2022년 6월 8일
Thank you very much!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by