Make this .mat variable DOUBLE- Help needed

조회 수: 8 (최근 30일)
BN
BN 2019년 10월 30일
편집: Bhaskar R 2019년 10월 30일
hello all
I want to make this attached .mat file to double, in order to use in griddedInterpolant function alongside some other doubled variables. I really search for it but can't find the answer. it doesn't matter to DateTime format keep, I just want the text that shows which row is what date. I've attached t.mat.
Thanks for your attention. I’m looking forward to your reply.

채택된 답변

Bhaskar R
Bhaskar R 2019년 10월 30일
편집: Bhaskar R 2019년 10월 30일
Hi,
load t;
date_data = datetime(cell2mat(t)); % to get the all data as datetime format
date_data_double = datevec(date_data); % convert the datetime data to double data in 6 columns
Hope helps you !
  댓글 수: 2
BN
BN 2019년 10월 30일
Dear Bhaskar,
I really appreciate your help. is there any way to have date_data_double in one column?
actually I need the 408*1 dimension, not 408*6
thank you
Bhaskar R
Bhaskar R 2019년 10월 30일
편집: Bhaskar R 2019년 10월 30일
Anyway you can get the double datatype serial value from the datetime data.
date_data_double = datenum(date_data); % as serial double data
Now your data is in 408*1 dimension
You can convert back this data to datetime data as
datetime_back = datetime(date_data_double, 'ConvertFrom','datenum');

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by