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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by