inputdlg box to pass variables
2 views (last 30 days)
Show older comments
Hi. I am trying to run a piece of matlab code a variable number of times and to pass it a variable each time.
I thought the input dlg was a good way to go. So in the example I want to run my matlab code 5 times, and each time pass in the number in the 2nd box. so the first time 1000, 2nd time 2000 etc.
with my code as below. I can't quite finish what I need
prompt={'Enter the Number of Timelapses (exposure Times)',...
'Enter The expsoure times, comma seperated:'};
name='Input Timelapse - Multi Exposure';
numlines=1;
defaultanswer={'5','1000,2000,3000,4000,5000'};
answer=inputdlg(prompt,name,numlines,defaultanswer)
nExp=str2double(answer(1,:))
exps=answer(2,:)
I get the following.
nExp =
5.00
exps =
'1000,2000,3000,4000,5000'
How do I access each of the numbers on line 2? Is this the best way to do what I want to do?
(the number of values needed to pass isn't always 5, it will be any number of values)
Thanks
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!