Unrecognized function errors MATLAB

4 views (last 30 days)
Toriano Thomas
Toriano Thomas on 5 May 2021
Edited: KSSV on 5 May 2021
Please help me solve the unrecognized errors line 18-29
prompt = ["input wet or dry:","What value do you want to find [time/thickness]:", "input the temperature in Kelvin:","enter index"];
dlgtitle = 'Values';
dims = [1 35];
answer = inputdlg(prompt,dlgtitle,dims);
global index %%creates popup display
global T
global kB
global X
str = string(answer{1}); %%creates string
str2 = string(answer{2});
T = str2num(answer{3});
index = string(answer{4}); %%creates index
kB = 8.617*10^-5; %%constant value kB
if str == 'wet' && str2 == "thickness" %%time and thickness
fprintf ("you want to find wet time!")
wettime(X)
elseif str == "wet" && str2 == "time"
fprintf ("you want to find wet thick!")
wetthick(X)
elseif str == "dry" && str2 == "thickness"
fprintf ("you want to find dry time!")
drytime(X)
elseif str == "dry" && str2 == "time"
fprintf ("you want to find dry thick!")
drythick(X)
else
fprintf ("input not understood try again")
end

Answers (1)

KSSV
KSSV on 5 May 2021
To compare two strings use strcmp. Read about it.
prompt = ["input wet or dry:","What value do you want to find [time/thickness]:", "input the temperature in Kelvin:","enter index"];
dlgtitle = 'Values';
dims = [1 35];
answer = inputdlg(prompt,dlgtitle,dims);
global index %%creates popup display
global T
global kB
global X
str = string(answer{1}); %%creates string
str2 = string(answer{2});
T = str2num(answer{3});
index = string(answer{4}); %%creates index
kB = 8.617*10^-5; %%constant value kB
if strcmp(str,'wet') && strcmp(str2,"thickness") %%time and thickness
fprintf ("you want to find wet time!")
wettime(X)
elseif strcmp(str,"wet") && strcmp(str2,"time")
fprintf ("you want to find wet thick!")
wetthick(X)
elseif strcmp(str,"dry") && strcmp(str2,"thickness")
fprintf ("you want to find dry time!")
drytime(X)
elseif strcmp(str,"dry") && strcmp(str2,"time")
fprintf ("you want to find dry thick!")
drythick(X)
else
fprintf ("input not understood try again")
end
  2 Comments
Toriano Thomas
Toriano Thomas on 5 May 2021
Thank you, unfortunately, the issue persists!
KSSV
KSSV on 5 May 2021
Edited: KSSV on 5 May 2021
wetthick and drythick should be a variable or function...this you should be knowing.

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!