The problem "Subscripted assignment dimension mismatch"?

1 Ansicht (letzte 30 Tage)
Lilya
Lilya am 26 Okt. 2015
Kommentiert: Lilya am 28 Okt. 2015
hi all,
I want to make for loop which count the date and time for each month in one year (2009) To make all of date time values in one column
Year=2009;
Month=1:12;
for i=1:size(Month);
SD(i) = datenum(Year,Month,1,0,0,0);
ED(i) = datenum(Year,Month+1,1,0,0,0)-(1/24);
end
But I get this error
Subscripted assignment dimension mismatch.
What does it mean!
thank you for the helping time

Antworten (1)

Walter Roberson
Walter Roberson am 26 Okt. 2015
Your Month is a vector. datenum(Year,Month,1,0,0,0) needs to be a vector because Month is a vector. You try to store that vector result into a single location.
  5 Kommentare
Walter Roberson
Walter Roberson am 26 Okt. 2015
My guess is you want
SD(i) = datenum(Year,Month(i),1,0,0,0);
and the corresponding change to ED
Lilya
Lilya am 28 Okt. 2015
Thank you for your response Mr. Walter

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Financial Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by