Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A.rows = [11,12,13,14,15]; % numeric vector
- A.cols = {'A','B','C','D','E'}; % cell of strings
- A.in = magic(5); % numeric matrix
- DS = mat2dataset(A.in,'VarNames',A.cols, 'ObsNames',cellstr(num2str(A.rows')));
- export(DS,'file','A.txt') %
- type A.txt
- A <- read.table('A.txt',header = TRUE)
- head(A)
- # Observations A B C D E
- # 1 11 17 24 1 8 15
- # 2 12 23 5 7 14 16
- # 3 13 4 6 13 20 22
- # 4 14 10 12 19 21 3
- # 5 15 11 18 25 2 9
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement