I have a question regarding the processing time of copying data into another array. I noticed that it takes much more time to copy complex single data compared to normal single value. Even if I preallocate both arrays.
% Example to show different processing speed of copying data
T1=0; % total time for single
T2=0; % total time for complex single
% preallocate rrays
Csingle = single(zeros(500,3000));
Cimagsingle =complex(Csingle);
for i=1:1000;
A =rand(500,3000,'single');
B = 1i.*A;
tic ;
C = A;
t1=toc;
T1=T1+t1;
tic;
Cimag = B;
t2=toc ;
T2=T2+t2;
end
The processing time in this example is
T1 = 0.6105
and
T2 = 1.1430
which is approximatley twice as slow!?
I do not understand this behavior. In a program I am writing to acquire real time data I need to copy complex data into a new array but the processing speed is way to slow. As a result my program is not able to function in real time.