"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 ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by