matlab调用gfortran编译的fortran程序出现end of file问题

https: // ww2.mathworks.cn/matlabcentral/answers/44388-or-system-or-unix-input-redirection#answer_56185

Executing a GFORTRAN executable within a Apple terminal window is not equivalent to executing it within MATLAB. In particular, MATLAB will set various environment variables and this can have unexpected results which seems to be the case here.

To work around this issue you need to set your environment variables for the GFORTRAN-compiled programs correctly within MATLAB before you execute them. You can use the SETENV function for this purpose. Please execute your FORTRAN script as follows:

setenv(‘GFORTRAN_STDIN_UNIT’, ‘5’)
setenv(‘GFORTRAN_STDOUT_UNIT’, ‘6’)
setenv(‘GFORTRAN_STDERR_UNIT’, ‘0’)
!./forward <
input
setenv(‘GFORTRAN_STDIN_UNIT’, ‘-1’)
setenv(‘GFORTRAN_STDOUT_UNIT’, ‘-1’)
setenv(‘GFORTRAN_STDERR_UNIT’, ‘-1’)

Note that after executing the FORTRAN script, I set the environment variables back to their default values.

Fatal error in MPI_Init:Other MPI error, error stack

一个MPI程序,出现这样的错误,仔细看看后续的提示行,是否出现如下的错误:gethostbyname failed
出现这种错误的原因是hosts文件中没有列入当前主机的hostname先看看主机的hostname是什么,用uname -a查看,比如我的是Linux scdzj 2.6.32-696.6.3.el6.x86_64 #1 SMP Wed Jul 12 14:17:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux则第二个字段scdzj是hostname打开/etc/hosts文件,在127.0.0.1的后面加上hostname,保存退出。这个问题即可解决。
stackoverflow. com/questions/23112515/mpich2-gethostbyname-failed

pandas的date_range时间偏置

想用pandas.data_range(start=’1970′,end=’2020′,freq=’Y’)来生成一个按年分布的时间序列,但实际结果是生成了这样的:1970-12-31,1971-12-31… …我需要的是每年开始的日期,经查找,发现可用如下办法:pandas.date_range(start=’1970′,end=’2020′,freq=pandas.offsets.YearBegin(1))即可。

===========================
也可以简单写成pandas.date_range(start=’1970′,end=’2020′,freq=’1YS’)

illustrator无法编辑matplotlib保存的矢量图中的文本

stackoverflow.com    /questions/5956182/cannot-edit-text-in-chart-exported-by-matplotlib-and-opened-in-illustrator

是由于默认的fonttype=3引起的,illustrator不能处理这种类型,可改为42(TrueType)就可以了:

>>> import matplotlib as mpl 

>>> mpl.rcParams['pdf.fonttype'] = 42