How can I create a new column vector to store dates?

1 回表示 (過去 30 日間)
Salman Kalinleh
Salman Kalinleh 2020 年 12 月 11 日
コメント済み: Salman Kalinleh 2020 年 12 月 14 日
Hi everyone,
I've been trying to create a column vector that is able to store diffrent dates, I've previously create a column vector to store the populations for each country so i wrote a code like this down :
countryPop = zeros(size(countries)); % Creating an empty coloumn vector to fill with the population of each country
for i = 1:length(countries) % Creating a for loop that will repeat 214 times for each country
iCountryFirst = find(strcmp(coviddata.countriesAndTerritories,countries(i)),1);
countryPop(i) = coviddata.popData2019(iCountryFirst);
end
This would create a coloumn vector and store the populations in it, however i'm trying to do this for dates now rather than populations of diffrent countires. The dates are stored in a DD/MM/YYYY format.
Please can somebody help be do this and many thanks,
Salman

採用された回答

Joel Van Sickel
Joel Van Sickel 2020 年 12 月 11 日
Hello Salman,
then similalry, you can store it in a new vector dates(i) = datetime(2020,12,12,0,0,0)
Regards,
Joel
  1 件のコメント
Salman Kalinleh
Salman Kalinleh 2020 年 12 月 14 日
Thanks for your help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by