how to assign variables to user inputs
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 18 de Feb. de 2018
‘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 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!