Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

An easy problem for you,propably

1 visualizzazione (ultimi 30 giorni)
Berke Kadir Türker
Berke Kadir Türker il 2 Mag 2019
Chiuso: MATLAB Answer Bot il 20 Ago 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

Risposte (1)

Rik
Rik il 2 Mag 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)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by