Hey guys, I need help with this input dialogue to function use.
1 次查看(过去 30 天)
显示 更早的评论
I'm a beginner so I need all the help I can get. I'm making a simple program to save time. It should give me minimum slab thickness, after giving the required input. It works as a simple function but I need it to work from the input dialogue. You can test it using these values. Clear span = 8 Thickness = 5 Strength = 40000
It should give an answer of 4.04 or 4.24 inch. Note: My code start from >>function EXP_Slab_Thick........
if true
% code
end
function EXP_Slab_Thick (~)
S = inputdlg({'Given clear span:' ,'Assumed thickness:' ,'Yield strength of steel:'},'required data', [1,45]);
a = str2double(S);
ln = S(1,1);
hfo = S(2,1);
fy = S(3,1);
l = ln + hfo/12;
if fy < 60000
h = (l/20)*(0.4+fy/100000)*12;
fprintf('The minimum height required is %.3f inch.\n Subtract o.75 from your new assumed height to get depth\n', h);
else
fprintf('Yield strength of steel is too high for this equation')
end
end
2 个评论
Adam
2018-7-27
ln and fy are both referring to the same output from the inputdlg. Is this intended? I assume not though since their names bear no relation to the strings of the input dialog it is hard to tell what each should be!
采纳的回答
Ben Frankel
2018-7-27
You calculate a correctly, but you never use it. Try this:
a = str2double(S);
ln = a(1);
hfo = a(2);
fy = a(3);
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!