How to categorize month/day/year into a period of months

4 ビュー (過去 30 日間)
Aj Jebelli
Aj Jebelli 2021 年 6 月 18 日
コメント済み: SALAH ALRABEEI 2021 年 6 月 18 日
I have data that looks like this:
Value Date
1 1/10/2018
2 1/14/2018
3 1/21/2018
4 2/22/2018
. .
. .
. .
16 4/21/2020
I want to categorize the days in Jan-2018 for example to be labeled "1', Feb-2018 would be labeled "2" etc. I am hoping my data would look like this:
Value Month
1 1
2 1
3 1
4 2

回答 (1 件)

SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 18 日
Assuming your date array is called A. This might work
Achar = char(A);
lab = A(:,1);
  2 件のコメント
Aj Jebelli
Aj Jebelli 2021 年 6 月 18 日
???
SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 18 日
sorry, this is the correct.
Achar = char(A);
lab = Achar(:,1);

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

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by