Question: in matlab Day-> 2 Month Min/Max 1 MAX MIN 2 MAX MIN 3 MAX MIN 4 MAX MIN 5 MAX MIN 46 Y2008 Y2009 2010
Day-> 2 Month Min/Max 1 MAX MIN 2 MAX MIN 3 MAX MIN 4 MAX MIN 5 MAX MIN 46 Y2008 Y2009 2010 2011 2012 2013 2014 ... Each year's data is stored in a separate sheet, and each pair of rows (MAX/MIN) are for a given month You are writing a program that will calculate the monthly maximum and minimum temperatures for a selected year. The program already has let the year be selected and the selected year is currently stored as a scalar in the variable Year. You need to read in the sheet from the Excel file which corresponds to the selected year and store the numeric data in TempData Read in the entire sheet and do not give any cell ranges From this data calculate the maximum monthly temperatures (the maximum of the MAX rows) and the minimum monthly temperatures (the minimum of the MIN rows) for each month. These values should be stored as Month Max and Month Min and should be 12x1 vectors (one monthly minimum and maximum value for every month of the selected year) Hints To not hardcode the sheet name, you need to create a string which matches the sheet name using the value in the variable Year. What function do you know that lets you created a formatted string that can include variable values? Finding the min and max monthly temperatures can be done in one line each. You don't need to do it 12 times (once for each month). Take a look at the doc pages for the min and max functions to see how to do this. Additionally, look at the next hint for help indexing . When you find the maximum monthly temperature, you want to find the maximum of the MAX rows not the MIN cows, therefore you want to pull out everyother row (the opposite is true for the minimum monthly temperature). You can do this with indexingt in addition to indexing a range like 3.11 which would pull positions through 11. you can include an increment value in the middle like 32.11 which would pull the positions through 11 in increments of 2 (in other words positions 3, 5, 7, 9, 11)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
