フィルターのクリア

Sort excel with respect to column date

1 回表示 (過去 30 日間)
Nagham Kabbara
Nagham Kabbara 2015 年 11 月 9 日
回答済み: Walter Roberson 2015 年 11 月 9 日
hi, in my program the user is able to add data which will be added to an excel sheet, this data contains a date.
what i would like to do is to sort the data in the excel with respect to the column date. i tried importing the array to matlab and use sortrows and i tried running a macro using actxserver but it didn't work!! i don't know if there's something missing here!!!
please help

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 11 月 9 日
If you have R2014b or later, you can use readtable() to read the xls file in a way that the dates will appear as datetime objects that can then be sorted.
If not then you can use xlsread(). If the dates are stored in Excel date format then what you receive in MATLAB will be something you can sort(), even though it will not be exactly in MATLAB datenum format. If the dates are stored in strings in Excel then you can use datenum() to convert them to datenum format, which you can then sort.

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by