Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Matlab Preserves Data in Memory, Even After I run ‘clearvars’
Date: Wed, 5 Dec 2012 14:54:08 +0000 (UTC)
Organization: HSBC
Lines: 9
Message-ID: <k9nn6g$6ub$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1354719248 7115 172.30.248.45 (5 Dec 2012 14:54:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 5 Dec 2012 14:54:08 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2921053
Xref: news.mathworks.com comp.soft-sys.matlab:784224

So, I run this code:
d = dir('C:\Users\Excel\Desktop\Excel_Files\*.xls*'); 
nfiles = length(d);
for k = 1:nfiles
   n=int2str(k);
   eval(['[num' n ', txt' n ', raw' n '] = xlsread(d(k).name,1);']);  
end

Everything imports fine.  However, if I change some data, and re-run the code, I get what I had initially, NOT the changed data.  So, I run ‘clearvars’, and try again; I get the initial data.  Then, I deleted ALL Excel files in the folder and run the code.  I get 0; this is what I’d expect.  However, if I create a new Excel file, and name it Book1, and put it in that same folder as before, I get what was in the FIRST Book1, not the ACTUAL/NEW Book1.  This makes no sense whatsoever.  It's like Matlab preserves things in it's memory, even after I run 'clearvars'.  It can't be like that.  There’s no practical application for that kind of thing.