2

I have HDF files of Chlorophyll data. I am trying to process these HDF4 files to generate NDVI for the period. but when I try to execute

Band = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','');
% Construct an RGB matrix from the three bands into one 3D matrix.
SPCrater_321 = cat(Band);
% Display the image
figure(1)
imshow(SPCrater_321)
xlabel('Longitude (pixels)')
ylabel('Latitude (pixels)')
title('ASTER Bands 3, 2, 1')
??? Error using ==> permute
Out of memory. Type HELP MEMORY for your options.
Error in ==> hdfsdsread at 57
data = permute(data,ndims(data):-1:1);
Error in ==> hdfread at 240
varargout{1} = hdfsdsread(hinfo,start,stride,edge);

Next execution is,

Band_3 = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','ImageData3N');
Band_2 = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','ImageData2');
Band_1 = hdfread('F:\MATLAB\HDF data\binned hdf\OCMHDFFiles_20-Sep-2012\O2_01APR2011_004_000_GAN_L3B_CL_M.hdf','clo','Fields','ImageData1');
% Calculate NDVI.
Band_2 = im2single(Band_2);
Band_3 = im2single(Band_3);
SPCrater_NDVI = (Band_3 - Band_2) ./ (Band_3 + Band_2);
% Display the image.
j=imresize(SPCrater_NDVI,0.5);
figure(5)
imshow(j,'DisplayRange',[0 1])
??? Out of memory. Type HELP MEMORY for your options.

And this is what I get when I type the 'memory' command at this point of execution:

memory
Maximum possible array:             255 MB (2.669e+008 bytes) *
Memory available for all arrays:    569 MB (5.971e+008 bytes) **
Memory used by MATLAB:             1197 MB (1.255e+009 bytes)
Physical Memory (RAM):             8181 MB (8.578e+009 bytes)
*  Limited by contiguous virtual address space available.
** Limited by virtual address space available.

can anyone please help me to solve this issue. how to increase the length of the memory array.

I really appreciate any help you can provide. I will be grateful if you can send me this information.

M. Prabu

(maprabu)

4
  • It looks like you're running on Windows ? Is it 32 bit or 64 bit Windows ? Commented Dec 14, 2012 at 8:56
  • yes i am using windows xp 32 bit. 8gb of ram. is there any solution to solve this problem Commented Dec 14, 2012 at 9:15
  • First, use the /3GB swwitch, as described in the technote linked in my answer. That, however, won't increase the size of the maximum array. Commented Dec 14, 2012 at 9:17
  • You probably need to go to a 64 bit OS, preferably a proper OS, but a 64 bit version of Windows should work also. Commented Dec 14, 2012 at 9:17

1 Answer 1

2

See this technote: http://www.mathworks.nl/help/matlab/matlab_prog/resolving-out-of-memory-errors.html?s_tid=doc_12b#brh72ex-52

The most straightforward solution is to go 64 bits.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.