源数据:5306行*15列
public class WindLoad01 {
public static void main(String[] args) throws Exception {
File file1 = new File("C:/Users/zzyuan/Desktop/test.txt");
double[][] map = new double[5306][15];
int n = map.length;
int m = map[0].length;
BufferedReader br = new BufferedReader(new FileReader(file1));
String[] line = null;
String s = "";
String str = "";
int index = 0;
while ((s = br.readLine()) != null){
line = s.split("\\s+");
for(int j = 0 ; j < 15 ; j++){
map[index][j] = Double.parseDouble(line[j]) - Double.parseDouble(line[j+15]);
map[index][j] *= 31;
str = String.format("%.2f",map[index][j]);
map[index][j] = Double.parseDouble(str);
}
index++;
}
File file2 = new File("C:/Users/zzyuan/Desktop/out.txt");
BufferedWriter wr = new BufferedWriter(new FileWriter(file2));
for (int i = 0; i < map.length; i++) {
for (int j = 0; j < map[0].length; j++) {
wr.write(map[i][j] + "\t");
}
wr.write("\r\n");
}
br.close();
wr.close();
}
}
结果:
|