Write Data to a File
20: Write data to a file
| For this example, A is a 10×3 array of values, where the first column are the x values 1 through 10, the second column are the y values where y=sqrt(x), and the third column are the z values where z=x2. |
1 1. 1 2 1.41421 4 3 1.73205 9 4 2. 16 5 2.23607 25 6 2.44949 36 7 2.64575 49 8 2.82843 64 9 3. 81 10 3.16228 100 |
| 1. create 10×3 array A 2. write the values of A to a text file A.dat, one row per line 3. generate a 7×11 matrix R of random values (uniform on [0,1]), and write them to file ranm.dat, four elements per line |
| Mathematica:
(1) (2) (3) R4 = Partition[Flatten[],4] |
Matlab:
(1) (2) (3) |
| Maple:
(1) (2) (3) |
IDL:
(1) (2) (3) |
