Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
 
 
主题工具 显示模式
旧 2019-12-14, 20:13   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,008
声望力: 66
poster 正向着好的方向发展
帖子 传递参数_ Shell脚本-八度脚本

如何将两个参数(数字矢量)从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

更多&回答...
poster 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 07:35


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.