%% Clear the command line, clear all workspace variable clc, clear %% Import sam
ID: 2084655 • Letter: #
Question
%% Clear the command line, clear all workspace variable clc, clear %% Import sample weather data wd = xlsread('weather_data.xls'); % read in the data to wd using xlsread wd = wd'; % transpose wd, so that months are in columns month = 2 % set the month of January %% Average in a month month_values = wd(:,month) month_values(month_values<0)=[] average_in_a_month = mean(month_values) %% Max in a month max_in_a_month = max(wd(:,month)) %% days of month when zero inches fell days_when_zero = find(month_values==0) %% # of days zero inches fell % num_days_when_zero = numel(days_when_zero) num_days_when_zero = sum(month_values==0) %% days when some rain fell num_days_when_zero = numel(days_when_zero) %% average inches of only days in which some rain fell
Explanation / Answer
%% Clear the command line, clear all workspace variable
clc; clrscr;
%% Import sample weather
function data wd = xlsread('weather_data.xls');
% read in the data to wd using xlsread wd = wd';
% transpose wd, so that months are in columns month = 2
% set the month of January
%% Average in a month
month_values = wd(:,month)
month_values(month_values<0)=[] ;
average_in_a_month = mean(month_values) ;
%% Max in a month
max_in_a_month = max(wd(:,month)) ;
%% days of month when zero inches fell
days_when_zero = find(month_values==0) ;
%% # of days zero inches fell %
num_days_when_zero = numel(days_when_zero)
num_days_when_zero = sum(month_values==0)
%% days when some rain fell
num_days_when_zero = numel(days_when_zero)
%% average inches of only days in which some rain fell
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.