inputdlg box to pass variables
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
1 Comment
Jason
on 6 Jun 2016
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion 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!