Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

accumarray issue (not working with large numbers?)

$
0
0
hey all,
this here works:
B = [1 2 3
1 3 4
2 2 2
3 4 5
3 3 3
3 5 9
4 8 9]

[unique(B(:,1)),accumarray(B(:,1),B(:,2),[],@prod)]

But, if I change matrix B's left column to these large numbers I get error.
so this below does not work:
format long
 B = [20120101 2 3
20120101 3 4
20120102 2 2
20120103 4 5
20120103 3 3
20120103 5 9
20120104 8 9]

[unique(B(:,1)),accumarray(B(:,1),B(:,2),[],@prod)]


Here is the error message:

??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

Error in ==> accumarray_issue at 22
[unique(B(:,1)),accumarray(B(:,1),B(:,2),[],@prod)]
 

Thanks a lot,
Larry

Viewing all articles
Browse latest Browse all 19628

Trending Articles