How to have a user input prompt more user inputs?
Ältere Kommentare anzeigen
I am writing a script that asks the user to input the number of layers in a composite. If the user inputs "n" layers, I then need "n" number of input dialog boxes to appear and prompt the user to enter information about each layer. Can someone please help???
Thank you.
1 Kommentar
dpb
am 19 Mär. 2014
Read the returned input, check for validity/sanity, then begin a for loop on that number, putting your input request inside. Of course, you'll need to check that return and process as well, so build a routine that does all this and call it in the loop.
Antworten (1)
Jos (10584)
am 19 Mär. 2014
N = str2double(inputdlg('How many inputs','N'))
if ~isempty(N) && ~isnan(N) && N > 0 && N < 10 % sanity check!
prompts = cellstr(strcat('Information about layer #',num2str((1:N).'))) ;
V = inputdlg(prompts, 'Information')
% V is a cell array of N strings
end
Kategorien
Mehr zu Big Data Processing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!