analyse table by row name

2 次查看(过去 30 天)
Hi,
I have two questions.
I read a csv file in matlab as below:
Now i want to sort the table by the first column. I only want to read the number that i have to fill in in the script. So that i can say, only read vin number ..... and use that data. Thats the first part.
My second question is how to use the date column on the right way? I want to use it in a plot but the last numbers are a bit weird. How can I read this and use this in a plot?
anyone who can help me?

采纳的回答

Aghamarsh Varanasi
Aghamarsh Varanasi 2021-5-28
Hi,
You can import the data as a table from csv form the import gui. To sort the table based on the first row, you can use 'sortrows' function. You can sort the table based on any given column. For example,
% to sort the table data based on first column. Lets assume data is saved
% in a table variable named 'table_data'
table_data = sortrows(table_data,1);
table_data_firstcolumn = table_data.vin; % access data in first column
To handle data in the format of date and time, 'datetime' function provides a way to import and convert the data in 'datetime' format. 'datetime' data can also be used in a plot. In your case, you can use the following code snippet to extact the date and time date.
time_data = table_data.createdDateTime;
time_array = datetime(time_data, 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z')
Hope this helps

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by