The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Matlab Preserves Data in Memory, Even After I run ‘clearvars’
Replies: 1   Last Post: Dec 5, 2012 12:52 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 150
Registered: 2/11/08
Matlab Preserves Data in Memory, Even After I run ‘clearvars’
Posted: Dec 5, 2012 9:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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

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.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.