フィルターのクリア

date into double then back to date in loop

3 ビュー (過去 30 日間)
Tatte Berklee
Tatte Berklee 2019 年 11 月 25 日
編集済み: Sean de Wolski 2019 年 11 月 25 日
I imported dates from an Excel file called original as below:
date =table2array(original(:,1));
datedouble= datenum(date);
I have a for-lop with a for loop variable j such that:
a(j+1,1)= datedouble(j+1,1);
My question: this for loop stores serial number of the date, and I want to conver this back to the dates. I tried datestr(datedouble(j+1,1)), but it says the dimension doesn't matach as it is some sort of 1x10 on the right hand side and left hand side is 1x1.
How can I resolve this?
Thanks!

採用された回答

Sean de Wolski
Sean de Wolski 2019 年 11 月 25 日
編集済み: Sean de Wolski 2019 年 11 月 25 日
You should really look at creating a datetime and using its various properties and methods instead of datenum or datestr.
Can you provide a small data set of what you have and what you want?
  1 件のコメント
Tatte Berklee
Tatte Berklee 2019 年 11 月 25 日
The issue I am having is a is K by L doubles.
I am running a for-loop in each row, so I store the date.
The issue is I am storing as serial numbers and as in double.
But I want this to change to the actual dates for ease of display when I plot.
So I tried datestr() function to convert back to characters.
When I try to store this into the entry in my for-loop, I get the following error:
Unable to perform assignment because the size of the left
side is 1-by-1 and the size of the right side is 1-by-20.
Help?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by