Help Changing Class/Type In A Table
3 次查看(过去 30 天)
显示 更早的评论
Hi y'all,
How do I change the class/type of values in a column into datetime? They were added as datetime going in. When I go to access the file after and check the class, it indicates the variables are catigorical. Why does this happen?
Thank you!
8 个评论
Cris LaPierre
2025-6-4
编辑:Cris LaPierre
2025-6-4
new_table = new_table_useful_data(with_datetime) ;
no_zeroz = remove_zeros(new_table) ;
no_ESD_over_150 = remove_ESD_greater_150(no_zeroz) ;
These 3 data processing functions are also not defined in the shared code either.
回答(1 个)
Cris LaPierre
2025-5-29
The best solution would be to fix how your data is imported. Then you don't hvae to convert it.
T.A = datetime(T.A,'InputFormat',infmt)
infmt should be set to match the current data. Since your data is categorical, you likely first need to convert it to a string or numeric data type. We could be more specific if you shared your data and code.
8 个评论
Cris LaPierre
2025-6-4
This code does not create categorical values. The code out.DateOnly.Format would throw an error. Are you sure the values are categoricals?
Can you identify where your code diverges from this example? Better yet, share your implementation of this approach.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!