Request user input and using that ans for my functions?

1 次查看(过去 30 天)
How can I use the user's input and convert it to a numerical value to be used in my remaining codes?
prompt=('Enter a threshold value to convert the grayscale image to black and white: ');
dlg_title=('Threshold level value');
num_lines=1;
defaultans={'0.5'};
answer=inputdlg(prompt,dlg_title,num_lines,defaultans);

采纳的回答

Stephen23
Stephen23 2016-1-15
>> val = str2double(answer{1})
val =
3

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Import, Export, and Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by