I am trying to get predefined dialog boxes to calculate arcsine of an argument I will put in a dialogue list. Bu what I do not understand is how I will get the answer arcsine(arg) to be written out in a message box, msbox. Someone who can help? The c

1 回表示 (過去 30 日間)
I am trying to get predefined dialog boxes to calculate arcsine of an argument I will put in a dialogue list.
Bu what I do not understand is how I will get the answer arcsine(arg) to be written out in a message box, msbox.
Someone who can help? The code below doesnt work.
list = {'arcsine', 'arccosine', 'natural logarithm'};
[indx,tf] = listdlg('Liststring', list);
A = inputdlg({'Enter an argument'},'arcsine');
Y = asin(A)
msgbox(num2string(Y))

回答 (1 件)

DGM
DGM 2021 年 4 月 9 日
Try something like this:
Y = asin(str2num(A{:}))
msgbox(sprintf('The arcsine of %s is %s',A{:},mat2str(Y,5)))
And this way also allows non-scalar inputs:

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by