how can i solve this problem about 'OUT OF MEMORY'

3 次查看(过去 30 天)
when i use matrix, i always got out of memory.... actually i put zeros fuction to avoid it..
but, it is not work at all.
i'm using window 7 32bit 2G RAM Matlab 7.11.0 R2010b
Matrix size is 256 by 192
it's not big CT Image
Even if it takes a long tome, i think that it has to be worked.
Someone told me that the latest version of matlab has problem on it..
how can i get out of this problem. plz help me..
i'm not good at Matlab.
nx = length(x);
ny = length(y);
nz = length(z);
% Remark: There may be some savings in fft computation if P is transposed
[nv,nu] = size(P);
u = (-u_off + [0:nu-1]')*du;
v = (-v_off + [0:nv-1]')*dv;
% Remark: if P is transposed, 'meshgrid' should be changed to 'ndgrid'
[uu,vv] = meshgrid(u,v);
weight = SDD./sqrt(SDD^2 + vv.^2 + uu.^2);
% Remark: P is over-written to conserve memory in following computations.
% The interpretation at each stage should be clear from context
P = P .* weight;
% Filtering:
Phihat = varargin{1};
if ~isempty(Phihat), % Skip to backprojection is filter is empty
% Remark: This call to fft can likely be optimised using the transpose
% of P instead to capitalise on Matlab's column-oriented storage.
P = fft( P, length(Phihat), 2 ); % Rows zero-padded automatically
% Remark: This loop can likely be vectorised using repmat
for j=1:nv
P(j,:) = P(j,:) .* Phihat ;
end;
% Remark: This call to fft can likely be optimised using the transpose
% of P instead to capitalise on Matlab's column-oriented storage.
P = real( ifft( P, [], 2 ) );
P = P(:,1:nu); % Trim zero-padding on rows
end % of if-block
% Increment to add to reconstruction in backprojection stage
dR = zeros(ny,nx,nz);
% Vectorised computation of backprojection
[yy, xx, zz] = ndgrid( y, x, z);
% Use projection matrix to project reconstruction (x,y,z) grid
% into detector (u,v) grid
*UV = A * [ xx(:)'; yy(:)'; zz(:)'; ones(1,nx*ny*nz) ];*
* ---------->this part*
% Nearest neighbour interpolation to find detector coordinates (u,v)
% that are closest to projections of voxels (x,y,z)
U = round( UV(1,:)./UV(3,:) ) + 1 ;
V = round( UV(2,:)./UV(3,:) ) + 1 ;
% Identify indices of voxels with projections strictly within detector grid
ind = find( (U>=1) & (V>=1) & (U<=nu) & (V<=nv) );
% Remark: This will have to be changed if P is transposed
P_ind = ( U(ind) - 1 )*nv + V(ind) ;
  3 个评论
Oleg Komarov
Oleg Komarov 2011-8-9
Also add the error message and which line it refers to.
Beyung Doo Jo
Beyung Doo Jo 2011-8-11
*UV = A * [ xx(:)'; yy(:)'; zz(:)'; ones(1,nx*ny*nz) ];*
* ---------->this part*
just they said that i got ' out of memory ', when i using above code.

请先登录,再进行评论。

回答(2 个)

Nirmal Gunaseelan
There is an excellent resource on understanding how MATLAB uses memory and how you can avoid out of memory issues - Avoiding Out of Memory issues - that might help you resolve such issues easily.

Sean de Wolski
Sean de Wolski 2011-8-9
Buy more RAM and upgrade to a 64bit system. CT scans, by nature, require a lot of memory. Also, you could convert to integers to save a little bit more.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by