Problem Exporting Very Large Array Data to an Excel Spreadsheet

Hello,
I am trying to summate elements from very large arrays( approx size: [500,000, 1] ) in groups of 1501 at a time(i.e. 1:1502, 1503:3004, etc.) to record the sums in cells of an excel spreadsheet.
Here is the script I am using:
i=int16(1);
j=int16(1);
g=int16(1);
for g=1:564
tracker = numel(tracking.x);
if (j+1501) <= (tracker-1502)
k = j+1501;
a = 'A';
integer = int16(i);
iString = mat2str(integer);
current_cell = strcat(a, iString);
output.x = sum(tracking.x(j:k));
output.y = sum(tracking.y(j:k));
i=i+1;
j=j+1502;
end
if (j+1501) > tracker
nested_j = tracker - j;
a = 'A';
integer = int16(i);
integer = int16(i);
iString = mat2str(integer);
current_cell = strcat(a, iString);
output.x = sum(tracking.x(j:(j+nested_j-1)));
output.y = sum(tracking.y(j:(j+nested_j-1)));
i=i+1;
end
xlswrite('C:\analysis\video tracking results\mouse 32\Aug27a_min.xlsx', ...
output.x, 1, current_cell);
xlswrite('C:\analysis\video tracking results\mouse 32\Aug27a_min.xlsx', ...
output.y, 2, current_cell);
end
The number of iterations for the variable 'g' can be considered arbitrary for this case(this is a conversion of recorded data from units/frame->units/min). The problem that I am having is that the iteration of the variable j does not seem to be capable of increasing beyond 32767; once it reaches that value, the output to the excel file repeats until the for loop resolves.
I have tried writing as units/min and units/s(i.e. varying the number of cells to write to) but inevitably the critical value at which j ceases to iterate is the same. I have tested the sums being generated prior to this critical point, and they do seem correct.
How can I fix or work around this failure of iteration?

2 Comments

Which MATLAB version are you using, and on which OS, and is Excel installed on the machine?
You might need to use MATLAB R2012A or later to write files that big.
The software involved is as follows: Windows 7(64-bit), SP1, with Excel(32-bit, version 14.0.6112.5000) installed locally, running MATLAB R2012a.

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Asked:

on 6 Jul 2012

Community Treasure Hunt

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

Start Hunting!