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 view (last 30 days)
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))

Answers (1)

DGM
DGM on 9 Apr 2021
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:

Tags

Community Treasure Hunt

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

Start Hunting!