Problem Exporting Very Large Array Data to an Excel Spreadsheet
Mostra commenti meno recenti
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 Commenti
Walter Roberson
il 6 Lug 2012
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.
Matt
il 9 Lug 2012
Risposte (0)
Categorie
Scopri di più su Develop Apps Using App Designer in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!