how to assign variables to user inputs
2 ビュー (過去 30 日間)
古いコメントを表示
I'm asking the user to input 6 values between 1 and 59, I want to assign variables to each input so they can be compared etc. I think the final line of code may help in doing this but I don't understand what it does?
prompt = {'Enter your first integer between 1 and 59', 'Enter your second integer between 1 and 59', 'Enter your third integer between 1 and 59', 'Enter your fourth integer between 1 and 59', 'Enter your fifth integer between 1 and 59', 'Enter your sixth integer between 1 and 59' };
dlg_title = 'User inputs';
num_lines = 1;
answer =inputdlg(prompt,dlg_title,num_lines);
dlg_answer{1}(1,:)
0 件のコメント
回答 (1 件)
Star Strider
2018 年 2 月 18 日
‘I think the final line of code may help in doing this but I don't understand what it does?’
The inputdlg function returns a cell array of character variables. If you want numbers from it, you may need to use the str2double to produce double-precision floating-point numbers.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!