How would you find the missing dates. This code only gives one of the missing dates

In your Workspace, variable "Date" contains the date information corresponding to each data point. However, several dates may be missing from the dataset. For the house you have picked, does the dataset contain all the dates from January 1, 2018 to March 31, 2018? Write code to count the total number of missing dates, display message(s) to present ALL missing dates for the house you have picked. Use a "for loop". Some code has been provided for you to get started, fix the code as mentioned to get correct results for missing dates. Refer to zyBook Challenge Activity 18.6.2 for a similar task.
t1=datetime(2018,1,1);% January 1, 2018, the starting date. "datetime" is a MATLAB built-in function.
t2=datetime(2018,3,31);% March 31, 2018, the ending date. "datetime" is a MATLAB built-in function.
t=t1:caldays(1):t2;% Variable "t" now contains all the dates from January 1, 2018 to March 31, 2018. "caldays" is a MATLAB built-in function.
DateMissing=datetime([],[],[]);% Creating a variable to store the missing dates for later use. "datetime" is a MATLAB built-in function.
for i=1:1:1length(t)% FIX ME
if ~any(Date==t(i))
DateMissing=[DateMissing,t(i)]% FIX ME
end
end

댓글 수: 5

Why should this question be removed? Did you violate some rule when you posted this question?
this is a homework question and I don't know if I would get plagerism for asking over here
Feel free to edit the question to rephrase the homework question in your own words, but don't edit away all text. I will restore the current state of the page if you do.
You should only get into trouble for plagiarism if you copy a solution passing it off as your own. Posting of the question without permission can be a copyright violation. Rephrasing it to keep the essence but change the words will take care of that.
This is also true for your other question. If you copy text from someone else, make sure you're allowed to re-publish that. When you click submit on this website you publish your post under a Creative Commons license.
I have removed the flags from your questions. Feel free to do the required edit. After that, please respond to the answers you have received. Please consider marking them as accepted answer if they solved your problem (this makes them easier to find for others with a similar question), or comment with any remaining issues.

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

카테고리

도움말 센터File Exchange에서 Time Series Objects에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2021년 12월 10일

댓글:

Rik
2021년 12월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by