- use the str = input(prompt,'s') syntax. The 's' means a string input is expected. Read more here.
- Once you capture the input, you need to do a comparison to find which item in Name it corresponds to.
- Use the info from #2 to find the corresponding row in Resistance.
Selecting values to make further calculations
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to complete the next step of my coding to design steel portal frames. For my next calculations I need to select a rafter section so I can do my stanchion calculations based on the resistance of my chosen rafter section. How can I select one of my displayed sections below and use the moment resistance as stated to continue my calcs.
Thanks
Lr = L/2 + h/tand(theta); % N is the distance from stanchion to base of reactant line where it meets the ground level
syms m
eqn = m^2/(2*w) + m*(5*Lr/3 - L/3) + w*L^2/8; % derived graphical method equation
M = solve(eqn,m);
m1 = max(double(M));
Y = -(w/2)*(-m1/w).^2 + w*L^2/8;
R = -(m1.^2/w) - m1.*Lr;
Mr = Y - R; % Target rafter Mp
disp (table( Mr ))
% Values from Blue Book put into directory to suggest members
Name = ["254x102x28"; "254x146x31"; "254x146x37"; "254x146x43"; "305x102x25"; "305x102x28";
Resistance = [97.1; 108; 133; 156; 94.1; 111; 132; 148; 169; 196; 171; 198; 233; 149; 181;
crossSectionInfo = table( Name, Resistance );
crossSectionInfo = sortrows( crossSectionInfo, 'Resistance' );
bestCrossSectionIndex = find( crossSectionInfo.Resistance > Mr, 5, 'first'); % five sections with suitable Mp resistance
disp( crossSectionInfo(bestCrossSectionIndex,:) )
result = input('Which steel section would you like to select?:');
disp( 'Value is');
disp(crossSectionInfo.Resistance);
0 个评论
采纳的回答
Cris LaPierre
2020-2-18
编辑:Cris LaPierre
2020-2-24
There are a couple errors with the snippet of code included above, but I suspect that is becaue some code is missing. Assuming it runs without error when it is all there, I'd suggest a couple things.
A stripped down version of how you could do this is below.
result = input('Which steel section would you like to select?:','s');
disp( 'Value is');
disp(crossSectionInfo.Resistance(Name==result));
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!