"Subscripted assignment dimension mismatch" error

Hello, i'm stuck at an issue in line 33 (Converting the UTC dates in the timetable to Local solar time (LST)) where it gives me this error "Subscripted assignment dimension mismatch" and i have no idea how to fix it. I have added another file next to the code which includes the timetable used in some of the equations. Any help will be greatly appreciated. Thanks.

 채택된 답변

Alex Mcaulley
Alex Mcaulley 2019년 2월 21일

0 개 추천

Your code fails in this line:
LST(i)= n(i)+(1/15)*(-Long_rad)+E_solar_rad;
The problem is that the rigth side of the equation is a 1x365 array. If this is correct, you need to preallocate the variable LST out of the loop:
LST = NaT(length(n),length(E_solar_rad));
And then assign the value in the loop:
LST(i,:)= n(i)+(1/15)*(-Long_rad)+E_solar_rad;

추가 답변 (0개)

카테고리

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

질문:

2019년 2월 20일

댓글:

2019년 2월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by