Effacer les filtres
Effacer les filtres

How to collect Y values in graph plot in MATLAB APP Designer other than indexing?

1 vue (au cours des 30 derniers jours)
Joao Gocan
Joao Gocan le 10 Fév 2021
Commenté : Joao Gocan le 10 Fév 2021
I keep getting the error: "Array indices must be positive integers or logical values." whenever I try to run my code.
I have a plot of delta Tc (the change in temperature for the refrigerant) against its flow rate. The problem is I would like to be able to collect the specific delta Tc values just by changing the discrete knob for the flowrate. The option I have found so far was indexing, however it does not accept values that are not integers. Can someone help me?
function CalculateButtonPushed(app, event)
t = readtable("flowrates.xlsx","Sheet",1);
Hrate = str2num(app.HotFlowrateLminKnob.Value);
Hin = str2num(app.HotFluidTemperatureInCListBox.Value);
flowrateC = str2double(app.ColdFlowrateLminKnob_2.Value);
specific_heat = 4200;
if Hrate == 1 && Hin == 60
x = table2array(t(:,"Fc1Lm60H"));
y = table2array(t(:,"delta_Tc1"));
plot(app.UIAxes,x,y);
delta_TC = y(flowrateC);
app.deltaTcEditField.Value = delta_TC;
heat_transferred = (flowrateC/60)*specific_heat*delta_TC;
app.HeattransferredJoulesEditField.Value = heat_transferred;
app.Lamp.Color = "g";
  1 commentaire
Joao Gocan
Joao Gocan le 10 Fév 2021
Already solved it: https://uk.mathworks.com/matlabcentral/answers/265065-question-about-finding-y-value-for-certain-x-value-of-a-plot#answer_207309

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by