Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,008
声望力: 66 ![]() |
![]()
如何将两个参数(数字矢量)从Shell脚本传递到Octave脚本?
那是主意。 在“ prove.sh”中 #!/bin/bash .... do something that processing vector1 vector2 ./draw.m Vector1 Vector2 在“ draw.m”中 plot(Vector1, Vector2) 谢谢!! 回答: ..而且,如果您允许,我为八度脚本添加了一个小变化,因为前者位于Matlab中;) Arrays.sh #!/bin/bash # create random data for i in {1..10}; do v1[$i]=$RANDOM; done for i in {1..10}; do v2[$i]=$RANDOM; done # save data to file echo ${v1[@]} > file.txt echo ${v2[@]} >> file.txt # call OCTAVE script octave draw.m 绘图 load ("-ascii", "file.txt") plot(file(1,:), file(2,:)) %# if you want see the graphic print('figure.ps', '-deps') %# save the result of 'plot' into a postscript file exit 更多&回答... |
![]() |
![]() |