Dear Statalisters
Could someone check the following function? Last year, I was able to run a similar function for exporting a structure to a file, but now the fputmatrix() keeps reporting the type mismatch error. It works for matrices and classes but not for structures as it did.
I am using Stata 15.1 just updated on Windows server 2012 R2.
Update: I just tried it using Stata 11.2 again on Windows server 2012 R2 and it works nicely. I really do not understand what is going on...
Many many thanks.
Best,
Federico
clear all
mata
struct _le {
real matrix pop_le40
}
struct _le check()
{
struct _le rowvector _4le
_4le = J(1, 2, _le())
_4le[1].pop_le40 = J(10, 10, 1)
_4le[2].pop_le40 = J(10, 10, 2)
_4le[1].pop_le40
_4le[2].pop_le40
filename = "Z:\Microsimulation\BPCOmicrosim\analysis\bpco \che ck"
fh = fopen(filename, "rw")
fputmatrix(fh, _4le)
fclose(fh)
return(_4le)
}
end
m struct_res = check()
Could someone check the following function? Last year, I was able to run a similar function for exporting a structure to a file, but now the fputmatrix() keeps reporting the type mismatch error. It works for matrices and classes but not for structures as it did.
I am using Stata 15.1 just updated on Windows server 2012 R2.
Update: I just tried it using Stata 11.2 again on Windows server 2012 R2 and it works nicely. I really do not understand what is going on...
Many many thanks.
Best,
Federico
clear all
mata
struct _le {
real matrix pop_le40
}
struct _le check()
{
struct _le rowvector _4le
_4le = J(1, 2, _le())
_4le[1].pop_le40 = J(10, 10, 1)
_4le[2].pop_le40 = J(10, 10, 2)
_4le[1].pop_le40
_4le[2].pop_le40
filename = "Z:\Microsimulation\BPCOmicrosim\analysis\bpco \che ck"
fh = fopen(filename, "rw")
fputmatrix(fh, _4le)
fclose(fh)
return(_4le)
}
end
m struct_res = check()
Comment