From: Peter Perkins <>
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$>
References: <jnc9v7$1ot$> <jnd2u6$95n$> <jne71p$sfl$> <jne9fm$aai$>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: 1335546165 25962 (27 Apr 2012 17:02:45 GMT)
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$>
Xref: 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.