Index exceeds matrix dimensions

1 Ansicht (letzte 30 Tage)
Megan Mirkhanian
Megan Mirkhanian am 18 Dez. 2019
Kommentiert: Ridwan Alam am 20 Dez. 2019
char_date_start= char(date_start);
char_date_end = char(date_end);
yearRange = str2num(char_date_start(1:4))+1:1:str2num(char_date_end(1:4));
dateCheck = table(yearRange',zeros(length(yearRange),1),'VariableNames',{'WaterYear','DayCount'});
  1 Kommentar
Ridwan Alam
Ridwan Alam am 20 Dez. 2019
Hi Megan, does the response below work? If yes, please accept the answer.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ridwan Alam
Ridwan Alam am 19 Dez. 2019
I tried this, it worked fine. No error:
date_start = "2015-01-01";
date_end = "2019-10-01";
char_date_start= char(date_start);
char_date_end = char(date_end);
yearRange = str2num(char_date_start(1:4))+1:1:str2num(char_date_end(1:4));
dateCheck = table(yearRange',zeros(length(yearRange),1),'VariableNames',{'WaterYear','DayCount'});
What's your date_start and date_end?

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by