analyse table by row name

2 ビュー (過去 30 日間)
Dion Theunissen
Dion Theunissen 2021 年 5 月 25 日
回答済み: Aghamarsh Varanasi 2021 年 5 月 28 日
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 Center および File ExchangeDates and Time についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by