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

2 次查看(过去 30 天)
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);

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by