フィルターのクリア

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

1 回表示 (過去 30 日間)
Joao Gocan
Joao Gocan 2021 年 2 月 10 日
コメント済み: Joao Gocan 2021 年 2 月 10 日
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 件のコメント
Joao Gocan
Joao Gocan 2021 年 2 月 10 日
Already solved it: https://uk.mathworks.com/matlabcentral/answers/265065-question-about-finding-y-value-for-certain-x-value-of-a-plot#answer_207309

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by