I am new to MATLAB, and I can't fathom this from the documentation.
function GotData(sender, args)
interval = args.DataBlock.TimeIntervalInMicroseconds;
doubles = args.DataBlock.AsDoubleArray();
x = 0;
complexCount = length(double(doubles))/2;
DATA = zeros(complexCount);
for index = 1:(complexCount-1)
realnum = doubles(2 * index);
imagnum = 1i * doubles(2 * index + 1);
complex = realnum + imagnum;
x = x + interval;
DATA(index) = [x complex];
end
disp(DATA)
end
I am getting an array of doubles from an event that fires in a .NET assembly. I'm splitting the array up so that each even item (in a 1 based array) is an imaginary number and each odd item is real. Then I create a two item array of the complex number and its interval. I want to then append this 1D array to a 2D array. How do I do that?
At the moment I'm getting an error: In an assignment A(I) = B, the number of elements in B and I must be the same.
. What should I be doing?
interval
is 1, but can be adjusted.