poster
2019-12-14, 20:13
如何将两个参数(数字矢量)从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
更多&回答... (https://stackoverflow.com/questions/4724756)
那是主意。
在“ 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
更多&回答... (https://stackoverflow.com/questions/4724756)