フィルターのクリア

Error converting datetime to month names

1 回表示 (過去 30 日間)
Collin Tuttle
Collin Tuttle 2017 年 2 月 1 日
回答済み: Walter Roberson 2017 年 2 月 1 日
I want to convert numbers 1-12 to month names in a text string (January, February, etc...) I was using this:
for m = 1:12
t = datetime(m,m,m)
mon = month(t,'name')
end
and it was working fine, however I tried this same exact thing and now it is no longer working, I am getting this error: Function 'subsindex' is not defined for values of class 'datetime'.
Does anyone know how to fix this, or another way to do this?
  1 件のコメント
the cyclist
the cyclist 2017 年 2 月 1 日
Perhaps you are calling from a different directory, finding a local function named month?
What do you get when you type
which month -all
?

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

採用された回答

Walter Roberson
Walter Roberson 2017 年 2 月 1 日
In order for that particular error to have occurred, you would have to already have a variable named "month", in which case MATLAB would think you were trying to index that variable using a datetime as the index.

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