1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
| clear all
[bottom]=xlsread('C:\Documents and Settings\AAA06846\My Documents\MATLAB\data_for_matlab','bottom');
[middle]=xlsread('C:\Documents and Settings\AAA06846\My Documents\MATLAB\data_for_matlab','middle');
[top]=xlsread('C:\Documents and Settings\AAA06846\My Documents\MATLAB\data_for_matlab','top');
[date]=xlsread('C:\Documents and Settings\AAA06846\My Documents\MATLAB\data_for_matlab','date');
global D M L K
D=[date]; %data time
M=[top]; %data temperature
L=[middle];
K=[bottom];
B=[M;K;L]; %to find the temperature minimum and maximum in the house
Tmin=min(min(B));
Tmax=max(max(B));
clear B
tic %mesure the time to compile the program
fig = figure('renderer','zbuffer'); %creation of figure
set(fig,'Units','Normalized','Position',[0 0 1 1]); %dimension figure
j=0;
while j<1 %while loop use for run and close the programm even if the second while loop is finished
i=1; %initialisation of variable
vals=0;
n=1;
A=length(D(:,1));
h1 = uicontrol('Style','togglebutton','Value',1,... %Star stop button
'Units','normalized',...
'Position',[.9 .4 .08 .05],...
'String','Start/Stop');
h2 = uicontrol('Style','togglebutton','Value',0,... %Close button
'Units','normalized',...
'Position',[.9 .3 .08 .05],...
'String','Close Figure');
h3 = uicontrol ('Style' , 'popup' ,... % speed popup
'Units','normalized',...
'Position' , [.9 .2 .08 .05],...
'String' , 'x1|x10|x100');
h4 = uicontrol ('Style' , 'popup' ,... % choose of room popup
'Units','normalized',...
'Position' , [.9 .1 .08 .05],...
'String' , 'livingroom|kitchen|bedroom1');
sli = uicontrol(fig, ... %slider button
'Style','slider',...
'Max',A, ...
'Min',1, ...
'value',i,...
'SliderStep',[1/A 0],...
'Position',[600 200 150 15]);
while i<A %loop for the time
set(sli,'value',i) %To increment the value of slider button with i
val2=get(h2,'value'); %To get back the value of close button
if val2==1
close %to close figure if we push button else continu to compile
break
else
val3=get(h3,'value'); %To get back the value of speed popup button
if val3==1
n=1; %speed=*1
elseif val3==2
n=10; %speed=*10
else val3==3;
n=100; %speed=*100
end
t=D(i)+693960; %exel star 1900 and matlab 0000 so 693961 is 1900 years in day
val4=get(h4,'value'); %To get back the value of room popup button
if val4==1 %if you choose living room
x2=358;
y2=369;
[f]=temp(M,i,x2,y2); %to call temperature function
subplot(2,2,1,'replacechildren'); %to impose the place of graph
pcolor(f); %to create a graph
shading('interp') %to delete the grid
xlabel('breadth in meter')
ylabel('length in meter')
text(5,260,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(5,230,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(5,15,texlabel('door'),...
'BackgroundColor',[1 1 1]);
text(335,15,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12} {\color{blue}livingroom top}')
c=colorbar;
caxis([Tmin Tmax]) %to create the minimum and the maximum of colorbar
axes(c);
ylabel('Temperature in Celcius') %label for the colorbar
text(14,-5, datestr(t),... %code to print the time
'fontsize',16,...
'EdgeColor','black',...
'LineWidth',1);
pause(0.1) %to wait 0.5s to show the next temperature picture for the next time
[g]=temp(L,i,x2,y2);
subplot(2,2,2,'replace');
pcolor(g);
shading('interp')
xlabel('breadth in meter')
ylabel('length in meter')
text(5,260,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(5,230,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(5,15,texlabel('door'),...
'BackgroundColor',[1 1 1]);
text(335,15,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12}{\color{blue}livingroom middle}')
d=colorbar;
caxis([Tmin Tmax])
axes(d);
ylabel('Temperature in Celcius')
pause(0.1)
[h]=temp(K,i,x2,y2);
subplot(2,2,3,'replace');
pcolor(h);
shading('interp')
xlabel('breadth in meter')
ylabel('length in meter')
text(5,260,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(5,230,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(5,15,texlabel('door'),...
'BackgroundColor',[1 1 1]);
text(335,15,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12} {\color{blue}livingroom bottom}')
e=colorbar;
caxis([Tmin Tmax])
axes(e);
ylabel('Temperature in Celcius')
pause(0.1)
elseif val4==2 %if you choose kitchen
x2=300;
y2=369;
[f]=temp(M,i,x2,y2); %to call temperature function
subplot(2,2,1,'replace'); %to impose the place of graph
pcolor(f); %to create a graph
shading('interp') %to delete the grid
xlabel('breadth in meter')
ylabel('length in meter')
text(170,12,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(312,170,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(5,12,texlabel('door'),...
'BackgroundColor',[1 1 1]);
text(335,12,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12} {\color{blue}kitchen top}')
c=colorbar;
caxis([Tmin Tmax]) %to create the minimum and the maximum of colorbar
axes(c);
ylabel('Temperature in Celcius') %label for the colorbar
text(14,-5, datestr(t),... %code to print the time
'fontsize',16,...
'EdgeColor','black',...
'LineWidth',1);
pause(0.1) %to wait 0.5s to show the next temperature picture for the next time
[g]=temp(L,i,x2,y2);
subplot(2,2,2,'replace');
pcolor(g);
shading('interp')
xlabel('breadth in meter')
ylabel('length in meter')
text(170,12,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(312,170,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(5,12,texlabel('door'),...
'BackgroundColor',[1 1 1]);
text(335,12,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12}{\color{blue}kitchen middle}')
d=colorbar;
caxis([Tmin Tmax])
axes(d);
ylabel('Temperature in Celcius')
pause(0.1)
[h]=temp(K,i,x2,y2);
subplot(2,2,3,'replace');
pcolor(h);
shading('interp')
xlabel('breadth in meter')
ylabel('length in meter')
text(170,12,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(312,170,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(5,12,texlabel('door'),...
'BackgroundColor',[1 1 1]);
text(335,12,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12} {\color{blue}kitchen bottom}')
e=colorbar;
caxis([Tmin Tmax])
axes(e);
ylabel('Temperature in Celcius')
pause(0.1)
else val4==3; %if you choose bedroom1
x2=358;
y2=369;
[f]=temp(M,i,x2,y2); %to call temperature function
subplot(2,2,1,'replace'); %to impose the place of graph
pcolor(f); %to create a graph
shading('interp') %to delete the grid
xlabel('breadth in meter')
ylabel('length in meter')
text(5,260,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(5,230,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(310,170,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(335,345,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12} {\color{blue}bedroom1 top}')
c=colorbar;
caxis([Tmin Tmax]) %to create the minimum and the maximum of colorbar
axes(c);
ylabel('Temperature in Celcius') %label for the colorbar
text(14,-5, datestr(t),... %code to print the time
'fontsize',16,...
'EdgeColor','black',...
'LineWidth',1);
pause(0.1) %to wait 0.5s to show the next temperature picture for the next time
[g]=temp(L,i,x2,y2);
subplot(2,2,2,'replace');
pcolor(g);
shading('interp')
xlabel('breadth in meter')
ylabel('length in meter')
text(5,260,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(5,230,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(310,170,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(335,345,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12}{\color{blue}bedroom1 middle}')
d=colorbar;
caxis([Tmin Tmax])
axes(d);
ylabel('Temperature in Celcius')
pause(0.1)
[h]=temp(K,i,x2,y2);
subplot(2,2,3,'replace');
pcolor(h);
shading('interp')
xlabel('breadth in meter')
ylabel('length in meter')
text(5,260,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(5,230,texlabel('window'),...
'BackgroundColor',[1 1 1]);
text(310,170,texlabel('radiator'),...
'BackgroundColor',[1 1 1]);
text(335,345,texlabel('door'),...
'BackgroundColor',[1 1 1]);
title('\fontsize{12} {\color{blue}bedroom1 bottom}')
e=colorbar;
caxis([Tmin Tmax])
axes(e);
ylabel('Temperature in Celcius')
pause(0.1)
end
vals= get(sli,'value'); %To get back the value of slider button
if vals~=i %if touch the slider button you change the i value and the i value becomes the value of your slider button
i=round(vals);
else %else continu the compilation
val=get(h1,'value'); %To get back the value of the start/stop button value
if val==0 %if you don't push the button the compilation continu because you increment i with n wich is the step choose whith the speed button
i=n+i;
end % else the compilation stop
end
end
end
if val2==1 %if you push the close button you get out of j while loop and stop the compilation because if j=1, j while loop stop
j=1;
end
end
toc %mesure the time to compile the program |
Partager