Error, matrix dimension must agree
1 view (last 30 days)
Show older comments
Ben Louie Yap
on 25 Apr 2020
Answered: Sampath Rachumallu
on 27 Apr 2020
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 Comments
Accepted Answer
Sampath Rachumallu
on 27 Apr 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on Dimensionality Reduction and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!