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

2 ビュー (過去 30 日間)
Zachary Dunagan
Zachary Dunagan 2021 年 1 月 18 日
コメント済み: Zachary Dunagan 2021 年 1 月 18 日
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 Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by