Assign dates with number
2 views (last 30 days)
Show older comments
stelios loizidis on 2 Mar 2022
Commented: Benjamin Thompson on 2 Mar 2022
I have the following code
% read from excel file
Fuels_Data=cell2mat(Data(2:17545))' % Fuels_Data: 1X17544
Ch_Day=367 % Ch_Day corresponds=367 6/1/2020, Ch_Day=368 corresponds 7/1/2020, etc.
What I want is the following: e.g. To have the variable date, to put the date I want (eg date= "6/1/2020") and the code to define that Ch_Day = 367. How can this happen?
Your help is important.
See the help article "Dates and Time" for information about working with dates and times in MATLAB. There is a function called days that can quickly calculate duration in days from day 0 in your "days" unit. Then if you have more specific questions please post your code and sample input file.
There are a large number of examples in the documentation. Here is one you can open in the live editor to get started:
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!