i want to use the data input by the user in the inputdlg for calculation, how can i do this??
5 views (last 30 days)
Show older comments
my code is like this
prompt = {'CompoundName','Temperature'};
dlg_title = 'Input';
num_lines = 1;
CompoundName = inputdlg(prompt,dlg_title, num_lines);
C1=126.1
C2=183
C3=77
C4=0
V=C1*T^C2/1+C3/T+C4/T^2;
if strcmp(CompoundName, 'Acetaldehyde')
fprintf=('viscosity: %d',V);
end
0 Comments
Accepted Answer
KSSV
on 5 Sep 2017
Edited: Guillaume
on 5 Sep 2017
Change line
fprintf=('viscosity: %d',V);
to
fprintf('viscosity: %d\n',V);
prompt = {'CompoundName','Temperature'};
dlg_title = 'Input';
num_lines = 1;
CompoundName = inputdlg(prompt,dlg_title, num_lines);
T = str2num(CompoundName{2}) ;
C1=126.1 ;
C2=183 ;
C3=77 ;
C4=0 ;
V=C1*T^C2/1+C3/T+C4/T^2;
if strcmp(CompoundName, 'Acetaldehyde')
fprintf('viscosity: %d',V);
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Startup and Shutdown 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!