Unrecognized function errors MATLAB

4 visualizaciones (últimos 30 días)
Toriano Thomas
Toriano Thomas el 5 de Mayo de 2021
Editada: KSSV el 5 de Mayo de 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

Respuestas (1)

KSSV
KSSV el 5 de Mayo de 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 comentarios
Toriano Thomas
Toriano Thomas el 5 de Mayo de 2021
Thank you, unfortunately, the issue persists!
KSSV
KSSV el 5 de Mayo de 2021
Editada: KSSV el 5 de Mayo de 2021
wetthick and drythick should be a variable or function...this you should be knowing.

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by