record of file

1 view (last 30 days)
huda nawaf
huda nawaf on 8 Jan 2012
hi,
is there function deal with file such record of file ?
i.e. my file with very large size, can I deal with file directly instead of using arrays.
thanks in advance

Answers (2)

Image Analyst
Image Analyst on 8 Jan 2012
How large are your files? How large would your arrays be? Hundreds of megabytes? What do you mean by "deal with"? How about fopen, fgetl, fread, etc.?
  1 Comment
huda nawaf
huda nawaf on 8 Jan 2012
thanks,
yes, hundreds of megabytes.
I mean read file .
my files contains rows with different lengths.
when read it as arrays , zeros will be inserted in empty cells of array, so become so large.
can structure do with file? then each record assigned for one row.

Sign in to comment.


Walter Roberson
Walter Roberson on 8 Jan 2012
You would have to write routines yourself to handle this.
There is no mechanism to position to a particular line number in a text file. The closest you can get to that is to read the file ahead of time looking for each beginning of line and recording the value of ftell() at the beginning of line. Then to position to a given line, you would index the recorded values at the line number and fseek() to that recorded position.
The MATLAB- provided routines that can deal with files as structures only work with binary files.
If you happen to have R2011b, then there is a new matfile object that can work with version -7.3 .mat files in order to retrieve an array location from a variable.
  2 Comments
huda nawaf
huda nawaf on 9 Jan 2012
thanks,
I have r2011a , can I update it or I have to install new one?
Walter Roberson
Walter Roberson on 9 Jan 2012
You would have to install a new one.
Note: The *b releases are never available in Student Version.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!