Hi, I am coding something in the app designer. I have tried it a test script and it worked fine but when coding into the app, there seems to be an error . Please Help !
1 次查看(过去 30 天)
显示 更早的评论
I have tested the following code in the script editor and it works fine. But as soon as I copy the code into the app designer, it failes not sure why.
Below is the code I used in the test script.
clc;
%introducing properties
Ta = 100;
Tb = 0;
dmax = 20; %max amount of the barrier could be i.e. size of the entire plastic
Height = 40;
width = 10;
k = 0.257;
iceThickness = 0.01;
A = (Height * width);
deltaT = Ta - Tb;
for d=1:dmax
Q(d) = (k * A * deltaT)/d;
end
T = transpose (Q);
j=0;
for i=1:dmax
j=j+1;
X(j,:) = [i];
end
volume = A*iceThickness;
iceMass = 0.917*volume;
iceMelt = 334*iceMass;
plot(X, T,'red','lineWidth',2); hold on;
yline(iceMelt,'blue','lineWidth',2); hold on;
I have attached the app code and it fails but I dont understand why the code keeps falling over. Can some please help explain what the issue is?
Thank you in advance.
0 个评论
采纳的回答
Kevin Holly
2023-1-30
You were not defining your property variables unless the editfields were changed. I added a startup function that pulls the values from the editfield. See app attached.
Note, you could just reference the editfield values and skip the need for the property variables. For instance, you could use app.ThermalConductivitykEditField.Value instead of app.k within your plot callback function.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!