MATLAB Answers

How to create an array with these properties?

1 view (last 30 days)
Behzad Navidi
Behzad Navidi on 29 Oct 2019
Commented: Behzad Navidi on 29 Oct 2019
I want to create a single array (408 x 1) that takes the exact values of time in this code:
t = datetime(1982,1,1):calmonths(1):datetime(2015,12,1);
t = datetime(t,'Format','yyyy-MM-dd');
time = transpose (t);
how to do it?
thank you all


Katarina Vuckovic
Katarina Vuckovic on 29 Oct 2019
x = cellstr(t)
x = x'
z = cell2mat(x)
If this does not work for you, there are many other data conversions that you can try. See link:
Sometimes you may need to do muliple conversions to get the type/format that you want.
Hope this helps.
Behzad Navidi
Behzad Navidi on 29 Oct 2019
Thank you it works well.
t = cellstr(t)
t = cell2mat(t)
really appriciate

Sign in to comment.

Answers (0)

Sign in to answer this question.