I need to export from Matlab to Stata an array of numbers and strings.
For example:
clear
r=2;
n=4;
X=unifrnd(0,1,r,n);
X_STATA=reshape(X.', r*n,1);
id_STATA=kron((1:1:r).', ones(n,1));
mode_STATA=repmat(["AIR"; "TRAIN"; "BUS"; "CAR"],r,1);
Here, I want to export X_STATA
, id_STATA
and mode_STATA
.
How can I do this?
In particular, I want to make sure that the numbers after the comma of the entries of X_STATA
are well exported, without inappropriate approximations.