Error matrix dimensions must agree
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Craig Anthony PIllay
il 4 Set 2019
Commentato: Craig Anthony PIllay
il 4 Set 2019
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 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!