Error, matrix dimension must agree
조회 수: 1 (최근 30일)
이전 댓글 표시
Voc = app.LinetolinevoltageVocEditField.Value;
Ioc = app.LinetolinecurrentAocEditField.Value;
Woc = app.ThreephasepowerkWocEditField.Value/3;
Vsc = app.LinetolinevoltageVscEditField.Value;
Isc = app.LinetolinecurrentAscEditField.Value;
Wsc = app.ThreephasepowerkWscEditField.Value/3;
Vp = app.PrimarysidelinevoltageVEditField.Value;
Vs = app.SecondorysidelinevoltageVEditField.Value;
if(app.StepdowntransformerButton.Value)
a = Vp ./ Vs;
if(app.DeltastarconnectionButton.Value)
Voc = Voc/sqrt(3);
pfoc = Woc/(Voc*Ioc);
if(pfoc>=1)
app.errorTextArea.Value = 'Error! Power factor is more than 1!';
else
Ro = Voc/(Ioc*pfoc);
app.RcTextArea.Value = num2str(Ro);
sineoc = sin(acos(pfoc));
Xm = Voc/(Ioc*sineoc);
app.XmTextArea.Value = num2str(Xm);
Isc = Isc/sqrt(3);
pfsc = Wsc/(Vsc*Isc);
if(pfsc>=1)
app.errorTextArea.Value = 'Error! Power factor is more than 1!';
else
Req = Wsc/(Isc*Isc);
Req = Req/(a*a);
app.ReqTextArea.Value = num2str(Req);
Zeq = Vsc/Isc;
Zeq = Zeq/(a*a);
Xeq = sqrt((Zeq*Zeq)-(Req*Req));
app.XeqTextArea.Value = num2str(Xeq);
end
end
I created 2 edit fields in app designer to allow user to input values into it and the program will calculate the a of it, but for the line a = Vp ./ Vs, it keeps showing matrix dimension must agree and I am running out of idea what should I do since I am still new to Matlab, any kind advices all comments will be appreciated, thanks and sorry for wasting your time!
댓글 수: 0
채택된 답변
Sampath Rachumallu
2020년 4월 27일
Here Vp ,Vs are of class 'char' and cannot be divided. So you have to convert them to integer format for division.Try
a = str2num(Vp) ./ str2num(Vs);
댓글 수: 0
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!