How to replace the data in one column with another column
Show older comments
I have this file in text format that contains a data table (see example 1). I want keep column 1 and 2, but replace column 3 and 4 with another set of data (see example 2). the format in example 1 would be keep as it, the number however needs to be replace. For example: < +000.0 +000.0 +000.3 +052.2> would become < +000.0 +000.0 +000.025009 +041.830138>
Example 1
< +000.0 +000.0 +000.0 +051.4 >
< +000.0 +000.0 +000.3 +052.2 >
Example 2
0.000000 38.370049
0.025009 41.830138
Example 3
<+000.0 +000.0 +000.000000 +038.370049 >
<+000.0 +000.0 +000.025009 +041.830138 >
Answers (1)
Thorsten
on 3 Dec 2014
D1 = dlmread('example1.txt');
D2 = dlmread('example2.txt');
M = [D1(:, 1:2) D2];
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!