URGENT DUE AT 12AM!! Using the inputdlg, how to get the answers/inputs to be 'remembered'
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alexandra
le 7 Déc 2014
Commenté : Image Analyst
le 8 Déc 2014
this is my entire code:
while true
dlg_prompts = {'Radius','delta_time','delta_theta'};
dlg_title = 'Calculate a Mass Moment of Inertia';
dlg_defaults = {'1','.01','3'};
opts.Resize = 'on'; % a structure
dlg_ans = inputdlg(dlg_prompts,dlg_title,1,dlg_defaults,opts)
r1 = str2num(dlg_ans{1})
dtime=str2num(dlg_ans{2})
dtheta=str2num(dlg_ans{3}')
axis([-2.*r1 2.*r1 -2.*r1 2.*r1])
title('Simulating Your Rotation')
hold on
for dtheta = [0:dtheta:360];
x = r1.*cosd(dtheta);
y=r1.*sind(dtheta);
plot(x,y,'o')
pause(dtime)
end
quest = 'Would you like to go again?';
qtitle = 'Continue?';
a = { 'Absolutely', 'No Way!'};
resp = questdlg(quest,qtitle,a{1},a{2},a{1});
if resp == a{2}
h=msgbox(sprintf('Thanks for your time on this A++ Project!'));
waitfor(h);
break
end
end
If I say yes to go again, the inputdlg should show the most recent values, not the initial defaults. HOW DO I DO THIS?!?
Réponse acceptée
Image Analyst
le 7 Déc 2014
At the bottom of the loop, redefine the defaults.
dlg_defaults = {num2str(r1), num2str(dtime), num2str(dtheta)};
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur MATLAB Compiler dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!