Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

An easy problem for you,propably

1 vue (au cours des 30 derniers jours)
Berke Kadir Türker
Berke Kadir Türker le 2 Mai 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
clc;
clear;
clear all;
temp= inputdlg('Ortam Sıcaklığını giriniz(Celcius)');
temp=str2double(temp)
if temp>=33
yazi=sprintf('T=%g(C)...Hava Aşırı SICAK...',temp)
elseif 33>temp>=24
yazi=sprintf('T=%g(C)...Hava Sıcak...',temp)
elseif 15<=temp<24
yazi=sprintf('T=%g(C)...Hava ILIK...',temp)
elseif 0<=temp<15
yazi=sprintf('T=%g(C)...Hava Soğuk...',temp)
else
yazi=sprintf('T=%g(C)...Hava Aşırı Soğuk...',temp)
end
msgbox(yazi)
I am trying to learn the program but i could not solve the problem.Don't stuck to the language its turkish.
My aim is if temp=>33 program should display a msgbox message that says The Air is so hot or sth and it should change in conditions

Réponses (1)

Rik
Rik le 2 Mai 2019
Matlab doesn't work with double conditions, so you need to use a setup like the one below if you want to keep your code structure.
temp= inputdlg('Ortam Sıcaklığını giriniz(Celcius)');
temp=str2double(temp)
if temp>=33
yazi=sprintf('T=%g(C)...Hava Aşırı SICAK...',temp)
elseif 33>temp && temp>=24
yazi=sprintf('T=%g(C)...Hava Sıcak...',temp)
elseif 15<=temp && temp<24
yazi=sprintf('T=%g(C)...Hava ILIK...',temp)
elseif 0<=temp && temp<15
yazi=sprintf('T=%g(C)...Hava Soğuk...',temp)
else
yazi=sprintf('T=%g(C)...Hava Aşırı Soğuk...',temp)
end
msgbox(yazi)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by