%Class for CO907, Tue, Week 1. %__________________________________________ %Author: Jiarui Cao %Date: 5 Nov 2013 %Purpose: Load data from file and study box plot close all; clear all; clc; clf; %% About loading data: %If you are new to Matlab, you could use 'home->importdata' then %select file(s) by hands. But it's important to learn how to load data within scripts. %It will save your time when you deal with massive files in different folders. %%% Detailed way to load. %set file path %filepath = ['/Users/.../']; %might be 'c:\\...\ ' for windows %set file name %filename=[filepath 'daily-maximum-temperatures-in-me.xls']; %load data %data = xlsread(filename, 'Sheet3'); %Notice:xlsread works only for Microsoft Excel files. For other file types use 'importdata' or 'load' %this works if in the same folder as .m file A = importdata('daily-maximum-temperatures-in-me.xls'); data = A.data.Sheet3; Year1 = data(:,1); % Year2 = data(:,2); % Year3 = data(:,3); % Year4 = data(:,4); % Year5 = data(:,5); % Year6 = data(:,6); % Year7 = data(:,7); % Year8 = data(:,8); % Year9 = data(:,9); % Year10 = data(:,10); boxplot(data) % Box plot. %nbins=50; %number of bins in histogram. %hist(Year1,nbins) % Generate histogram of data from one year.