Prev: question about recent changes in 'eigs' and use on near-singularmatrices
Next: matlab compiler error mbuild -setup
From: Tiger Smith on 3 Feb 2010 14:17 I'm working on a very large data and using fread to load the data. Because of the data size I cut the data into four pieces and load four times. Each time I tell matlab the data I loaded in Bytes. Is this necessary?I just wonder whether matlab remember the position of each reading using fread or I need to tell matlab where to begin each time. Anybody can give me some clue? Thanks.
From: Matt J on 3 Feb 2010 14:24 "Tiger Smith" <loscleaa(a)gmail.com> wrote in message <hkci42$flc$1(a)fred.mathworks.com>... > I'm working on a very large data and using fread to load the data. Because of the data size I cut the data into four pieces and load four times. Each time I tell matlab the data I loaded in Bytes. Is this necessary?I just wonder whether matlab remember the position of each reading using fread or I need to tell matlab where to begin each time. ======================== Yes, MATLAB remembers, at least until you issue fclose(), fseek(), or similar...
From: Ashish Uthama on 3 Feb 2010 14:27 On Wed, 03 Feb 2010 14:17:22 -0500, Tiger Smith <loscleaa(a)gmail.com> wrote: > I'm working on a very large data and using fread to load the data. > Because of the data size I cut the data into four pieces and load four > times. Each time I tell matlab the data I loaded in Bytes. Is this > necessary?I just wonder whether matlab remember the position of each > reading using fread or I need to tell matlab where to begin each time. > > > Anybody can give me some clue? > Thanks. As long as you dont mess around with the file id (as returned by FOPEN), MATLAB should keep track of where it is at. >> fid=fopen('out.dat','wb'); >> fwrite(fid,[ 1 2 3 4],'uint8'); >> fclose(fid); >> fid=fopen('out.dat','rb'); >> fread(fid,1) ans = 1 >> fread(fid,1) ans = 2 >> fread(fid,1) ans = 3 >> fread(fid,1) ans = 4 >> fread(fid,1)
From: ImageAnalyst on 3 Feb 2010 14:31 And to further beat this dead horse, we have this, right from the top of the help file for fread(): "A = fread(fileID, sizeA) reads sizeA elements into A and positions the file pointer after the last element read."
From: Tiger Smith on 3 Feb 2010 14:42
Thanks. So here sizeA is not in bytes but in elements? ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <ee6f1704-c42d-41af-8a3e-7aa15741c340(a)j6g2000vbd.googlegroups.com>... > And to further beat this dead horse, we have this, right from the top > of the help file for fread(): > > "A = fread(fileID, sizeA) reads sizeA elements into A and positions > the file pointer after the last element read." |