필터 지우기
필터 지우기

GRPSTATS and datetime columns

조회 수: 4 (최근 30일)
Brian
Brian 2015년 3월 19일
댓글: Peter Perkins 2015년 3월 22일
Hi, I use grpstats to calculate statistics by different variables often. The new datetime format is very useful and I have converted many of my date handling procedures to utilize datetime arrays. However, when I have a table with a date field in the format of datetime it seems like grpstats can not properly use this field as a grouping statistic. I get the message below, indicating that a datetime field is not a plausible grouping variable format. Is there a way around this? Will this be fixed in the near future?
Error using grp2idx (line 117) A grouping variable must be a categorical, numeric, or logical vector, a cell vector of strings, or a 2D character array.
Thanks for your help, Brian
  댓글 수: 1
dpb
dpb 2015년 3월 19일
I don't have the latest datetime type/class/whatever it actually is; can you cast it to a double a la a traditional date number for the purpose?

댓글을 달려면 로그인하십시오.

답변 (1개)

Sean de Wolski
Sean de Wolski 2015년 3월 19일
Use year, hour, day etc. of the datetime to extract the time component that you want to group by and then call grpstats.
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2015년 3월 20일
I don't know and wouldn't be able to discuss future enhancements anyway.
Peter Perkins
Peter Perkins 2015년 3월 22일
Brian, that's certainly something we're looking into.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by