Path: news.mathworks.com!not-for-mail
From: Peter Perkins <Peter.Remove.Perkins.This@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: What is the best way to import Excel
Date: Fri, 27 Apr 2012 13:02:44 -0400
Organization: The MathWorks, Inc.
Lines: 19
Message-ID: <jnejfk$pba$1@newscl01ah.mathworks.com>
References: <jnc9v7$1ot$1@newscl01ah.mathworks.com> <jnd2u6$95n$1@newscl01ah.mathworks.com> <jne71p$sfl$1@newscl01ah.mathworks.com> <jne9fm$aai$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: ah-pperkins.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1335546165 25962 172.31.57.194 (27 Apr 2012 17:02:45 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 27 Apr 2012 17:02:45 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
In-Reply-To: <jne9fm$aai$1@newscl01ah.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:766160

On 4/27/2012 10:12 AM, Ryan wrote:
> I just tried this:
> [a,b] = xlsread('stock_data.xls');
> plot(datenum(stocks.Dates),stocks.MSFT,'o');
> datetick('x',1,'keepticks');
>
> The code pretty much makes sense, but generates this error:
> ??? Undefined function or variable 'stocks'.

Right, you haven't created a variable called stocks.  The code I 
suggested presumed you had executed the code from my earlier post, i.e.,

stocks = dataset('XLSFile','stock_data.xls');

That line creates what's called a dataset array.  The rest of the code 
demonstrated a few things:  selecting a subset from a dataset array, 
creating a new dataset variable based on existing ones, plotting two 
dataset variables, computing statistics on groups in the data.  The 
documentation for the Statistics Toolbox has all of this in the User Guide.