Multiple inputs using dialog box then inputs are placed into equation to get an output?

2 views (last 30 days)
I am trying to use the input dialog box to calcuate an equation. I know how to use the single input function and creating a function file that would accept multiple inputs but I don't want to use either of those.
% Ask user to input force, height and length of weld.
dlgtitle = 'Inputs';
prompt = {'Force (lbf)', 'Weld Height (in)', 'Weld Length (in)'};
dims = [1, 35];
[P_bw, h_bw, L_bw] = inputdlg(prompt, dlgtitle, dims);
sigma_bw = P_bw / (h_bw * L_bw);

Answers (1)

Walter Roberson
Walter Roberson on 18 Jan 2021
sigma_bw = str2double(P_bw) ./ (str2double(h_bw) .* str2double(L_bw));

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!