Textscan not reading an entire file
4 views (last 30 days)
Show older comments
I have multiple files in excel format .js . The files are identical, only the number or rows change. I used textscan to read in the data, and everything was working fine. Today after maybe one month of not using that script I tried to load in the data for only 2 files and I noticed that the first file is loaded in correctly, but the second one loads only up until 172 rows (and the file has 286). I tried loading only the problematic file, with the same results. I have saved data in matlab from one month ago, and then it was successfully loaded. I also downloaded that file again, in case it was corrupt. I use matlab R2010b 64bit. Here is the code:
myFolderPV = 'C:\...\test/';
PVFiles = dir(fullfile(myFolderPV,'*.js'));
for k = 1:2
fid = fopen(PVFiles(k).name);
tempDay {k} = textscan(fid, '%*s %s %*[^\n]', 'delimiter',' " ');
fclose (fid);
end
UPDATE: I tried to run the script on the other computer, and everything works fine.. So my guess is the problem is with my version of Matlab (but it worked before) or something changed with the configuration of my PC.. Any ideas? Thank you for your help, Ante
1 Comment
Jan
on 14 May 2013
Edited: Jan
on 14 May 2013
Usually ".js" are not Excel files. textread() cannot read Excel files, except you are talkinmg of tab separated text files - but it is brute to call them "Excel files".
It would be easier to understand the problem, when you post the contents of the last imported line. You mention "problems with your version of Matlab", but show us the version of the successful Matlab only.
Answers (1)
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!