필터 지우기
필터 지우기

how to combine contents from multiple cells into one cell or datevector?

조회 수: 1 (최근 30일)
I have just downloaded some data as a .csv and the date came in format: 12,10,1,12,30 (yy,mm,dd,hh,mn) for each column in the row and the data followed in the subsequent columns of each row. I am trying to combine the contents of the five columns into one column or add the columns using datevec so that I can get a datenumber. Anyone know how I would approach this?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 6월 7일
x={12,10,1,12,30;13,5,24,13,30}
x=cell2mat(x)
x=[x zeros(size(x,1),1)]
y=datenum(x)
  댓글 수: 1
Ryan Dillingham
Ryan Dillingham 2013년 6월 7일
perfect! Thanks Azzi, that worked very well. I was then able to turn the datenumber into a datevec which was nice too.
date={[Column1],[Column2],[Column3],[Column4],[Column5]};
date = cell2mat(date);
date = [date zeros(size(date,1),1)];
y = datenum(x);
y = datevec(y);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by