필터 지우기
필터 지우기

Textscan not reading an entire file

조회 수: 4 (최근 30일)
Ante
Ante 2013년 5월 14일
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
Jan
Jan 2013년 5월 14일
편집: Jan 2013년 5월 14일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ante
Ante 2013년 5월 14일
I think I solved the problem. (if this can be called a solution) So, after I noticed that the script runs fine on the other PC, I created a new folder, copied the script there and when I run it from that folder everything works. I'm still not sure why it doesn't work in my original folder..

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by