Unable to perform assignment because the size of the left side is different
2 次查看(过去 30 天)
显示 更早的评论
I'm at a loss. I've spent hours on this forum looking answers and can't seem to figure out the issue.
Here's the error message I get:
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 16-by-1.
Error in HW1b (line 130)
answer(i,1) = TeintS;
Here's my code. Sorry it's long. All variables have been previously defined, I've left them out to try ad keep my code shorter
Tair = xlsread(filename,'D3:D26'); %this is outdoor dry bulb air
Tsky = xlsread(filename,1,'I3:I26');
Tgr = Tsky;
QDir_S = xlsread(filename,1,'O3:O26');
QDif_S = xlsread(filename,1,'P3:P26');
QDir_E = xlsread(filename,1,'Q3:Q26');
QDif_E = xlsread(filename,1,'R3:R26');
h_S = xlsread(filename,1,'G3:G26');
h_E = xlsread(filename,1,'H3:H26');
% Define Matrix
answer = zeros(24,4);
for i = 1:24
%h value equations
h_is = 1.823*(abs((Tsint-Tint))^0.29)/(2.5^0.1);
h_ie = 1.823*(abs((Teint-Tint))^0.29)/(2.5^0.1);
%East Exterior
QsolarEO = (QDif_E(i) + QDir_E(i))*alphaE;
QradSkyEO = AreaE*Fesky*EmLwE*EmLwSky*SB*(Tsky(i)^4 - Teout^4);
QradGrEO = AreaE*Fegr*EmLwE*EmLwGr*SB*(Tgr(i)^4 - Teout^4);
QconvEO = AreaE * h_E(i)*(Tair(i) - Teout);
QcondEO = AreaE*(K_E/deltE)*(Teint - Teout);
%South Exterior
QsolarSO = (QDif_S(i) + QDir_S(i))*0.5*alphaS;
QsolarISO = (QDif_S(i) + QDir_S(i))*tauS*0.5*(AreaS*alphaS/(AreaE*alphaE + AreaS*(alphaS + tauS)+ AreaInt*alphaInt));
QradSkySO = AreaS*Fssky*EmLwS*EmLwSky*SB*(Tsky(i)^4 - Tsout^4);
QradGrSO = AreaS*Fsgr*EmLwS*EmLwGr*SB*(Tgr(i)^4 - Tsout^4);
QconvSO = AreaS*h_S(i)*(Tair(i) -Tsout);
QcondSO = AreaS*(K_S/deltS)*(Tsint - Tsout);
%East Interior
QsolarEI = (QDif_S(i) + QDir_S(i))*tauS*(AreaE*alphaE/(AreaE*alphaE + AreaS*(alphaS + tauS)+ AreaInt*alphaInt));
QradSIEI = AreaE*Fes*EmLwE*EmLwS*SB*(Tsint^4 - Teint^4);
QradIEI = AreaE*Fei*EmLwE*EmLwInt*SB*(Tint^4 - Teint^4);
QconvEI = AreaE*h_ie*(Tint - Teint);
QcondEI = AreaE*(K_E/deltE)*(Teout - Teint);
%South Interior
QsolarSI = (QDif_S(i) + QDir_S(i))*.5*alphaS;
QsolarISI = (QDif_S(i) + QDir_S(i))*tauS*0.5*(AreaS*alphaS/(AreaE*alphaE + AreaS*(alphaS + tauS) + AreaInt*alphaInt));
QradEISI = AreaS*Fse*EmLwS*EmLwE*SB*(Teint^4 - Tsint^4);
QradISI = AreaS*Fsi*EmLwS*EmLwInt*SB*(Tint^4 - Tsint^4);
QconvSI = AreaS*h_is*(Tint - Tsint);
QcondSI = AreaS*(K_S/deltS)*(Tsout - Tsint);
%Equations
EqEO = QsolarEO + QradSkyEO + QradGrEO + QconvEO + QcondEO;
EqEI = QsolarEI + QradSIEI + QradIEI + QconvEI + QcondEI;
EqSO = QsolarSO + QsolarISO+ QradSkySO + QradGrSO + QconvSO + QcondSO;
EqSI = QsolarSI + QsolarISI + QradEISI + QradISI + QconvSI + QcondSI;
[Teint, Teout, Tsint, Tsout] = solve(EqEO, EqEI, EqSO, EqSO);
answer(i,1) = Teint;
answer(i,2) = Teout;
answer(i,3) = Tsint;
answer(i,4) = Tsout;
end
disp(answer)
3 个评论
Rik
2020-10-20
Regarding your flag ("question was unable to be solved and there are similar questions in which an answer has been given"):
The fact that you didn't receive a satisfactory answer doesn't mean your question should be removed. It might help others with a similar question reach a solution on their own. Therefore I don't see any reason to delete your question. If you disagree, feel free to post a comment explaining why this thread should be deleted.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!