Dimension error in matrix manipulation

Hi!!
I have a B matrix made of variables. It supposed to give me just one value per row (23 rows), but instead is giving me 230 rows, and off course it is not matching the dimensions of my A matrix. I cannot find the error in the script. Here is my Bmatrix:
%Define B Matrix BMAT=[-qsunN-hout*Tamb-hskyN*Tsky-(Pbrick*Cpbrick*(Lbriw/2)*(1/deltat));%B1
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pbrick*Cpbrick*(Linsw/2)*(1/deltat));%B2
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B3
-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B4
-qsunS-hout*Tamb-hskyS*Tsky-(Pbrick*Cpbrick*(Lbriw/2)*(1/deltat));%B5
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pbrick*Cpbrick*(Linsw/2)*(1/deltat));%B6
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B7
-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B8
-qsunE-hout*Tamb-hskyE*Tsky-(Pbrick*Cpbrick*(Lbriw/2)*(1/deltat));%B9
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pbrick*Cpbrick*(Linsw/2)*(1/deltat));%B10
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B11
-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B12
-qsunW-hout*Tamb-hskyW*Tsky-(Pbrick*Cpbrick*(Lbriw/2)*(1/deltat));%B13
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pbrick*Cpbrick*(Linsw/2)*(1/deltat));%B14
-(Pins*Cpins*(Linsw/2)*(1/deltat))-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B15
-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B16
-qsunE-hout*Tamb-hskyE*Tsky-(Pglas*Cpglas*Lglas*(1/deltat));%B17
-qsunS-hout*Tamb-hskyS*Tsky-(Pglas*Cpglas*Lglas*(1/deltat));%B18
-qsunW-hout*Tamb-hskyW*Tsky-(Pglas*Cpglas*Lglas*(1/deltat));%B19
-qsunR-hout*Tamb-hsky*Tsky-(Pcon*Cpcon*(Lcon/2)*(1/deltat));%B20
-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat))-(Pcon*Cpcon*(Lcon/2)*(1/deltat));%B21
-(Pgyps*Cpgyps*(Lgypw/2)*(1/deltat));%B22
-qsunE-qsunS-qsunW-qach-qin]%B23
fprintf('BMAT')
DATA=xlswrite('Data 3',BMAT)
Thanks!

 Akzeptierte Antwort

Image Analyst
Image Analyst am 19 Okt. 2014

0 Stimmen

We have no idea what all the variable values are, so we can't figure out why it's 230 rows tall instead of 23 rows. My guess is that one of those rows B1 through B23 is a column vector. Just assign B1 through B23 one at a time, then look at the sizes of them all before you concatenate and see which one is not a 1x1 scalar value but is a column vector instead.

Weitere Antworten (1)

Margarita
Margarita am 19 Okt. 2014

0 Stimmen

Thanks I will do it and see

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by