Question: Write and test a matlab function requiring reading from a file. The national tourist bureau lists the major tourist cities and the average high and
Write and test a matlab function requiring reading from a file.
The national tourist bureau lists the major tourist cities and the average high and low for each city in the file http://www.cs.iit.edu/~cs104/labs/Lab10/avgTempResortCities.xls
The data format is: City,JanHigh,JanLow,AprHigh,AprLow,JulHigh,JulLow,OctHigh,OctLow
Write a function resortTemp that will read in the file and displays a list of cities whose temperature falls within a specified range for a certain month. The function has 2 parameters: the name of the file (a string '*.xls') and a vector of 3 elements: the number of the numeric column of data (1 is JanHigh, 2 is JanLow, . . . 8 is OctLow) to inspect, the low temperature for the range of that data and the high temperature for the range of that data. The function displays the names of the cities whose specified data falls in the given range. Hint: [num txt]=xlsfileread(filename) will assign the text of the excel spreadsheet to txt, and the numeric values of the spreadsheet to num) . Here is a sample run that will display a list of cities whose average April low (numeric column 4) temperature are between 60 and 80 degrees:
>> resortTemp('avgTempResortCities.xls',[4 60 80]) 'Acapulco (Mexico)' 'Bangkok (Thailand)' 'Bombay (India)' 'Calcutta (India) ' 'Hong Kong (China)' 'Kingston (Jamaica)' 'Lagos (Nigeria) ' 'Nassau (Bahamas) ' 'Rio de Janeiro (Brazil)' 'San Jos (Costa Rica)' 'San Juan (Puerto Rico) ' 'Singapore ' 'Taipei (Taiwan)'
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
