I want to import only specific Types of variables using readtable.
11 visualizzazioni (ultimi 30 giorni)
Hello, so I am using 'readtable' to import some text data that I have. I am then using 'table2timetable' to be able to use my data as a time table. The data if have is collected sparatically at different minutes and hours, so I am using
NewData = retime(TimeTableOut,'hourly','mean');
to average the values into a whole hour row.
But I am getting this error.
All variables in input timetables must be numeric, datetime, or duration when synchronizing using 'mean'.
I understood what that meant so I deleted the coumns (variables) of the imported table that contain data that is not of these types. It worked once I did this, but I would like to know if there is a better way to do this so I don't have to go in and delete columns myself every time. I would like to import data columns (variables) that contain only these three types of data. Any help is appreciated! If you need, I can attach my table or text file that I am importing.
Eric Sofen il 25 Giu 2020
You can use vartype to subscript into the table and select only variables that are a certain datatype (or meta-type like 'numeric'). Then, if you want the other data as well, you might circle back with ~vartype('numeric') and use one of the other retime aggregation methods (e.g. 'firstvalue') that will work with text data.