Export from Matlab to Stata an array of numbers and strings

user3285148

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_STATAand 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.

user8682794

In Matlab you can do the following:

writematrix(X_STATA, 'myfile.csv', 'precision', 17)

In Stata you import the data like this:

import delimited myfile.csv, asdouble

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Extract Numbers from Array mixed with strings - Javascript

From Dev

how to get numbers from array of strings?

From Dev

Converting strings to numbers in matlab

From Dev

Printing only consecutive numbers from an array in matlab

From Dev

Convert numbers from mathematica csv export to numpy complex array

From Dev

TypeScript creating Set/Array from array of numbers or strings

From Dev

numbers and strings in array python

From Dev

Matlab join array of strings

From Dev

input array of strings in matlab

From Dev

Convert numbers stored as strings from array of objects using jq?

From Dev

Pass array of ints from checked radio buttons instead of strings of numbers

From Dev

How can i turn an array of arrays from strings to numbers in Javascript?

From Dev

calculate mean from cell array with mixed numbers and strings

From Dev

Returning only numbers and removing strings from existing array in javascript?

From Dev

Extract numbers from multiple strings in an array and then sum - Excel

From Dev

Array gets filled with strings instead of numbers on a conversion from jQuery to JS

From Dev

Send array of floating point numbers from MATLAB to Arduino

From Dev

How to create a structure with fields from an array of strings in matlab?

From Dev

Removing 'NaN' strings and [] cells from cell array in Matlab

From Dev

Convert array of strings to array of numbers?

From Dev

Export function from mathematica to matlab

From Dev

How to sort an array by numbers in strings?

From Dev

Range of numbers to array of number strings?

From Dev

Separating numbers to different strings or an array

From Dev

Sort an array of strings starting by numbers

From Dev

Array of only strings or only numbers

From Dev

Looping through an array of strings in Matlab

From Dev

Attempting to parse numbers from strings and store in array but array seems to have no contents after more than one iteration

From Dev

Extract numbers as strings from list of numbers

Related Related

  1. 1

    Extract Numbers from Array mixed with strings - Javascript

  2. 2

    how to get numbers from array of strings?

  3. 3

    Converting strings to numbers in matlab

  4. 4

    Printing only consecutive numbers from an array in matlab

  5. 5

    Convert numbers from mathematica csv export to numpy complex array

  6. 6

    TypeScript creating Set/Array from array of numbers or strings

  7. 7

    numbers and strings in array python

  8. 8

    Matlab join array of strings

  9. 9

    input array of strings in matlab

  10. 10

    Convert numbers stored as strings from array of objects using jq?

  11. 11

    Pass array of ints from checked radio buttons instead of strings of numbers

  12. 12

    How can i turn an array of arrays from strings to numbers in Javascript?

  13. 13

    calculate mean from cell array with mixed numbers and strings

  14. 14

    Returning only numbers and removing strings from existing array in javascript?

  15. 15

    Extract numbers from multiple strings in an array and then sum - Excel

  16. 16

    Array gets filled with strings instead of numbers on a conversion from jQuery to JS

  17. 17

    Send array of floating point numbers from MATLAB to Arduino

  18. 18

    How to create a structure with fields from an array of strings in matlab?

  19. 19

    Removing 'NaN' strings and [] cells from cell array in Matlab

  20. 20

    Convert array of strings to array of numbers?

  21. 21

    Export function from mathematica to matlab

  22. 22

    How to sort an array by numbers in strings?

  23. 23

    Range of numbers to array of number strings?

  24. 24

    Separating numbers to different strings or an array

  25. 25

    Sort an array of strings starting by numbers

  26. 26

    Array of only strings or only numbers

  27. 27

    Looping through an array of strings in Matlab

  28. 28

    Attempting to parse numbers from strings and store in array but array seems to have no contents after more than one iteration

  29. 29

    Extract numbers as strings from list of numbers

HotTag

Archive