Hello,
If i create a cell with 1000 matrices ( size of each matrix 800*1280), clearing each matrix after using it will speed up calculations ?
Example
A=cell(1000,1);for i=1:1000 A{i}=rand(800,1280);endimage=A{1};image2=A{2}; % I will use image and image2 with other functions
A{1}=[];A{2}=[];
EDIT
The real use of the cell will be like :
A=cell(1000,1);parfor i=1:1000 A{i}=function_that_creates_image(800,1280); % image with size 800*1280 px
endfor i=1:number_of_images % number_of_images=1000 in this case
image1=A{1}; image2=A{2}; A{1}=[]; A{2}=[]; % image1 and image 2 will be used then in the next lines
%next lines of code
end
I noticed that calculating components of A in a parfor loop is faster than calculating each component for each loop inside the for loop
Thank you in advance
Best Answer