"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.

 采纳的回答

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 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by