I have two distinct double variables with one column and 30000 rows each. For instance:
A=[53
76
41
74
34
237
43…]
B= [1985
1985
1985
…
1986
1986
…
2013…]
If I do:
size(unique(A),1)
ans =261
size(unique(B),1)
ans = 27
But when I do:
D1=dummyvar(A)
I get a double matrix with 355 columns and 30000 rows of 1s and 0s, meaning that Matlab has identified 355 different dummies instead of 261.
and,
D2=dummyvar(B)
I get as well, a double with 2012 columns, what is also incorrect.
Matlab is identifying more dummies in my categorical columns as expected, so I must be doing something wrong, but I don’t know what because previously this formula worked for me. Can someone help me please? Thank you.