Ok, it seems like the problem is not version of windows, but rather version of Matlab. The import works in 2010a but not in 2012a or 2012b. Why would a newer version have less functionality?
Info
This question is closed. Reopen it to edit or answer.
importdata difference between Win xp and Win 7
1 view (last 30 days)
Show older comments
Hi,
I have files looking like this:
*Start file***
,
0 .5987549
10 .5987549
20 .5984497
30 .5981445
40 .5978394
50 .5978394
60 .5975342
70 .597229
80 .597229
90 .5969238
***END FILE***
I know they are messy, but it's the way my program exports them, nothing I can do about it. Note that they start with a \n and is followed by a comma on the subsequent row. Also note that there are two spaces separating the data columns. On my old computer running Windows XP, I am able to simply use importdata() som import the date from these files. In Windows 7, the command imports no data. I have not been able to figure out what the difference is, can anyone help?
1 Comment
Answers (1)
Jan
on 19 Nov 2012
Edited: Jan
on 19 Nov 2012
Newer versions of Matlab tend to be smarter. And the smart import of a malformed file will more likely crash.
Fortunately the format looks odd, but easy:
function Data = MyImportFcn(FileName)
FID = fopen(FileName, 'r');
if FID == -1
error('Tool:MyImportFcn:MissingFile', ...
'Cannot open file: %s', FileName);
end
fgetl(fid);
fgetl(fid);
Data = fscanf(FID, '%g ', Inf);
Data = transpose(reshape(Data, 2, []));
fclose(FID);
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!