필터 지우기
필터 지우기

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 CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by