python导出数据成mat,在python中将数据导出到.mat文件

我正在用python编写一个脚本,在这个脚本中,我可以将ls输出传递到脚本中,并使用scipy.io打开python中我想使用的所有文件,然后将它们分配到一个.mat文件中(同样使用scipy.io)。我已经成功地导入了数据并将其分配到一个字典中导出,但是当我在MATLAB中加载我的输出文件时,所有的数据看起来都不一样。在

我要导入的数据都有一个纬度/经度坐标,因此我将以这些数据为例。数据来自netCDF(.nc)文件:#!/usr/bin/python

import sys

import scipy.io as sio

import numpy as np

# script take absolute path inputs (or absolute paths are desirable)

# to access an abolute path on a linux systen use the command:

# ls -d $PWD/* OR if files not in PWD then ls -d /absolute_file_path/*

# and then pipe the standard output of that to input of this script

# initialize dictionary (param) and cycle number (i.e. datafile number)

cycle = []

param = {}

# read each file from stdin

for filename in sys.stdin:

fh = sio.netcdf.netcdf_file(filename,'r')

# load in

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值