MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   传递参数_ Shell脚本-八度脚本 (https://www.labfans.com/bbs/showthread.php?t=26186)

poster 2019-12-14 20:13

传递参数_ Shell脚本-八度脚本
 
如何将两个参数(数字矢量)从Shell脚本传递到Octave脚本?

那是主意。

[B]在“ prove.sh”中[/B]

#!/bin/bash .... do something that processing vector1 vector2 ./draw.m Vector1 Vector2 在“ draw.m”中

plot(Vector1, Vector2) 谢谢!!



[B]回答:[/B]

..而且,如果您允许,我为八度脚本添加了一个小变化,因为前者位于Matlab中;)

[B]Arrays.sh[/B]

#!/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 [B]绘图[/B]

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

[url=https://stackoverflow.com/questions/4724756]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 18:03

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