analyse table by row name

2 visualizzazioni (ultimi 30 giorni)
Dion Theunissen
Dion Theunissen il 25 Mag 2021
Risposto: Aghamarsh Varanasi il 28 Mag 2021
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?

Risposta accettata

Aghamarsh Varanasi
Aghamarsh Varanasi il 28 Mag 2021
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

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by