How to concatenate table columns into one columns

1 回表示 (過去 30 日間)
JFz
JFz 2015 年 8 月 7 日
コメント済み: JFz 2015 年 8 月 7 日
I have a Matlab table with three columns: Year, Month, Day. I want to make it into one column that represents the date in a format 'MM/dd/yyyy'. How can I do that? I tried quite a while to no avail, but I believe someone may know it immediately. Thanks.
The Table T has 3 columns (Year, Month, Day) and 10 rows.

採用された回答

Andrei Bobrov
Andrei Bobrov 2015 年 8 月 7 日
編集済み: Andrei Bobrov 2015 年 8 月 7 日
T = [randi([2014 2016],10,1),randi([1 12],10,1),randi([1 28],10,1)];
out = datestr(datenum(T),'mm/dd/yyyy');
  2 件のコメント
JFz
JFz 2015 年 8 月 7 日
Wow. It works! Exactly what I wanted to have! Thank you so much!
JFz
JFz 2015 年 8 月 7 日
Curious, how does Matlab know which column is for Year, whichis for month? In the code, you didn't specify which column goes where?

サインインしてコメントする。

その他の回答 (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