Error matrix dimensions must agree
조회 수: 1 (최근 30일)
이전 댓글 표시
I have an issue when running a check of units when a button is pushed.
I have a drown down menu for units and my code should calculate the the actual number depending on what units is selected.
for example if m3/hr is chosen then the fllowrate is divided by 3600 converting to m3/s however if ft3/s is chosen then the flowrate is converted to m3/s
When i run the code intially if i donot change the units there is no error however if i change the drown menu i.e. the units it gives the error.
Matrix dimensions must agree.
I understand the error is because on of my variables is a being treated like a matrix however i am not sure how to fix.
Error occurs on line 5
I have tried to run the code in a value change function however the same problem occurs.
FlowrateUnitsOne = ['m' char(179) '/hr'];
FlowrateUnitsTwo = ['ft' char(179) '/hr'];
FlowrateUnitscheck = app.FlowrateUnits.Value;
app.FlowrateUnits.ValueChangedFcn;
if eq(FlowrateUnitscheck,FlowrateUnitsOne)
Flowrate = app.FlowrateofLiquidEditField.Value/(2.2046*3600);
app.Label.Text = sprintf('%d',Flowrate);
elseif eq(FlowrateUnitscheck,FlowrateUnitsTwo)
Flowrate = app.FlowrateofLiquidEditField.Value/(3600);
app.Label.Text = sprintf('%d',Flowrate);
end
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!