function saveData(Lon, Lat) % 将两个数组转置为列向量 col1 = Lon(:); col2 = Lat(:); % 将2个列向量连接成矩阵? matrix = [col1, col2]; % 打开文件以进行写入? outFileID = fopen('output.txt', 'w'); % 将矩阵写入文件? fprintf(outFileID, '%d %d\n', matrix'); % 关闭文件 fclose(outFileID); end