Filter löschen
Filter löschen

Textscan not reading an entire file

4 Ansichten (letzte 30 Tage)
Ante
Ante am 14 Mai 2013
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 Kommentar
Jan
Jan am 14 Mai 2013
Bearbeitet: Jan am 14 Mai 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ante
Ante am 14 Mai 2013
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..

Kategorien

Mehr zu Large Files and Big Data finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by