Question
The m-file create_cell_example.m creates a cell array with the average monthly precipitation values for three cities. The array also contains the names of the cities,
The m-file create_cell_example.m creates a cell array with the average monthly precipitation values for three cities. The array also contains the names of the cities, the names of the precipitation types and strings containing abbreviations of the months of the year. Start with the template file cell_exercise_template.m to create an m-file (named cell_exercise_LastName.m) that produces a bar chart of the average monthly rainfall and snowfall for Minneapolis. You must use cell-array indexing to access the strings for use in the title, legend and x-axis tick labels.
Here is the create_cell_example.m
Here is the cell_exercise_template.m that needs to be used to that produces the rain and snow for Minneapolis
???????
cities = {"New Orleans"Minneapolis"San Diego'); precip-type = {'rain','snow'); months = {Jan,Feb"Mar"Apr',May,Jun, JulAug,Sep,"Oct, Nov,"Dec'); 96 City 1: New Orleans % average monthly rainfall (inches) precip-amt(1,1,:-[5.05 6.01 490 4.50 4.56 5.84 6.12 6.17 5.51 3.05 4.42 5.75; % average monthly snowfall (inches) precip-amt(1,2,:) = zeros(1,12); 6 City 2: Minneapolis % average monthly rainfall (inches) precip-amt(2,1,:) = [0.95 0.88 1.94 2.42 3.39 4.05 3.53 3.62 2.72 219 1.55 1.08]; % average monthly snowfall (inches) precip_amt(2,2:) [12.1 7.8 10.2 2.5 0.010. 0 0 0.010.6 9.3 11.5]; 6 City 3: San Diego % average monthly rainfall (inches) precip_amt(3,1:) [1.80 1.53 1.77 0.79 0.19 0.07 0.02 0.10 0.24 0.37 1.45 1.57] % average monthly snowfall (inches) precip-amt(3,2,:) = zeros(1,12); 96 Place city name strings in cell(1) 6 Place precipitation type name strings in cell(2) 96 Place month name strings in cell(3) % Place precipitation amounts in cell(4) avg-precip = (cities,precip-type,months,precip-amt); clear cities precip_type months precip_amt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started