From: jim on
sorry about that last post, my message got lost

both comptuers should be running 64 bit matlab. From what I read online, this tends to be installed by default on 64 bit computers. One computer, running matlab 2009, says win64 on the splash screen. The other computer, running matlab 2008a, has a large memory space:
>> memory
Maximum possible array: 12649 MB (1.326e+010 bytes) *
Memory available for all arrays: 12649 MB (1.326e+010 bytes) *
Memory used by MATLAB: 2268 MB (2.378e+009 bytes)
Physical Memory (RAM): 8061 MB (8.452e+009 bytes)

* Limited by System Memory (physical + swap file) available.



Even if I load a 1gb files as 16 bit, it still chokes for a very long duration, around 5 miunutes. Im wondering if this is normal? What should I expect?
fid = fopen(concated,'r');
rf_d1 = uint16(fread(fid, 'int16'));
or map it to 8 bit range takes 3-4 minutes too as well as reduces resolution.
rf_d1 = uint8(fread(fid, 'int16')/256);



Is there a way to use fread or fscan to only read a range of the file, say 100mb at a time. Someone hinted there is away to do this but have not got this to work yet.
From: jimmy mac on


think this is the tutorial i will be using.
http://www.mathworks.com/access/helpdesk/help/techdoc/import_export/f5-6031.html
refence section on reading portions of a file
From: us on
On Apr 8, 5:19 pm, "jim" <ji...(a)engr.uconn.edu> wrote:
> sorry about that last post, my message got lost
>
> both comptuers should be running 64 bit matlab.   From what I read online, this tends to be installed by default on 64 bit computers. One computer, running matlab 2009, says win64 on the splash screen. The other computer, running matlab 2008a, has a large memory space:>> memory
>
> Maximum possible array:              12649 MB (1.326e+010 bytes) *
> Memory available for all arrays:     12649 MB (1.326e+010 bytes) *
> Memory used by MATLAB:                2268 MB (2.378e+009 bytes)
> Physical Memory (RAM):                8061 MB (8.452e+009 bytes)
>
> *  Limited by System Memory (physical + swap file) available.
>
> Even if I load a 1gb files as 16 bit, it still chokes for a very long duration, around 5 miunutes. Im wondering if this is normal?  What should I expect?
>    fid = fopen(concated,'r');
>    rf_d1 = uint16(fread(fid, 'int16'));  
> or map it to 8 bit range takes 3-4 minutes too as well as reduces resolution.
>    rf_d1 = uint8(fread(fid, 'int16')/256);  
>
> Is there a way to use fread or fscan to only read a range of the file, say 100mb at a time. Someone hinted there is away to do this but have not got this to work yet.

did you look at what i told you(?)...

us
From: Steven Lord on

"jim" <jimmy(a)engr.uconn.edu> wrote in message
news:hpks5b$kv6$1(a)fred.mathworks.com...
> sorry about that last post, my message got lost
>
> both comptuers should be running 64 bit matlab. From what I read online,
> this tends to be installed by default on 64 bit computers. One computer,
> running matlab 2009, says win64 on the splash screen. The other computer,
> running matlab 2008a, has a large memory space:
>>> memory
> Maximum possible array: 12649 MB (1.326e+010 bytes) *
> Memory available for all arrays: 12649 MB (1.326e+010 bytes) *
> Memory used by MATLAB: 2268 MB (2.378e+009 bytes)
> Physical Memory (RAM): 8061 MB (8.452e+009 bytes)
>
> * Limited by System Memory (physical + swap file) available.
>
>
>
> Even if I load a 1gb files as 16 bit, it still chokes for a very long
> duration, around 5 miunutes. Im wondering if this is normal? What should
> I expect?
> fid = fopen(concated,'r');
> rf_d1 = uint16(fread(fid, 'int16'));

If you look at FREAD, this reads in the data (treating it as int16 data),
stores it in a double array, and then converts that double array into
uint16. That requires a significant amount more memory than telling FREAD
to read in the data as int16 directly into a uint16 array. Read the
documentation on the 'precision' parameter for FREAD in the documentation
for that function.

doc fread

*snip*

> Is there a way to use fread or fscan to only read a range of the file, say
> 100mb at a time. Someone hinted there is away to do this but have not got
> this to work yet.

Look at the 'size' parameter on the FREAD reference page I pointed to above.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Walter Roberson on
jim wrote:

> fid = fopen(concated,'r');
> rf_d1 = uint16(fread(fid, 'int16')); or map it to 8 bit range takes
> 3-4 minutes too as well as reduces resolution.

Don't do that.

rf_dl = fread(fid, 'int16=>uint16');

This will do the conversion when the bytes are read, saving the program
from having to create a temporary output matrix later to process the
uint16() call.

Also, are you sure that you want to convert signed 16 bit numbers to
unsigned 16 bit numbers? uint16() applied to a negative value gives a
result of 0, and of course since signed 16 bit numbers cannot exceed
32767, the uint16() call would not produce any output larger than that.
Perhaps what you want is to read directly as unsigned?

rf_dl = fread(fid, 'uint16=>uint16');