matlab find low temps using if else statements. I did the high values, but need
ID: 3802351 • Letter: M
Question
matlab find low temps using if else statements.
I did the high values, but need help with the low ones. thank you!
Using weather data provided, create a script that returns the values below. input weather. mat 96 output High City, HighTemp, HighTempDay LowCity, LowTemp, LowTempDay filename: weather. m load weather. mat High City row index of high temp High Temp max temp in array 96 HighTempDay column index minus 1 of high temp High City J high-temps with codest1, 1); zip code of first city High Temp high temps with codest1, 2 High TempDay 1; [Rows, Columns size(high temps with codes); E for RowIndex 1 1 Rows for Column Index 2 1 Columns if (High Temp high temps with codestRowIndex, ColumnIndex 96 we found new high temp High Temp high-temps with codestRowIndex, Column Index High TempDay Column Index 1; High City high temps with codes Row Index 11; else we keep looking end end L endExplanation / Answer
//Following code calculate all mentioned things.
load('weather.mat')
HighCity=high_temps_with_codes{1,1};
HighTemp=high_temps_with_codes{1,2};
highTempDay=1;
LowCity=low_temps_with_codes{1,1};
LowTemp=low_temps_with_codes{1,2};
lowTempDay=1;
[Rows,Columns]=size(high_temps_with_codes);
for RowIndex=1:1:Rows
for ColumnIndex=2:1:Columns
if(HighTemp < high_temps_with_codes{RowIndex,ColumnIndex})
HighTemp=high_temps_with_codes{RowIndex,ColumnIndex}
HighTempDay=ColumnIndex-1;
HighCity=high_temps_with_codes{RowIndex,1};
if(LowTemp > low_temps_with_codes{RowIndex,ColumnIndex})
LowTemp=low_temps_with_codes{RowIndex,ColumnIndex}
LowTempDay=ColumnIndex-1;
LowCity=low_temps_with_codes{RowIndex,1};
end;
end;
end;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.