[英]How can I use the output of a python script as RASA’s input instead of the usual user input?
[英]How can I use a python output as a matlab input?
我有一個運行良好的 python 代碼,我想使用 python 代碼的 output 作為 matlab 的輸入,我該怎么做?
You can write the code within a function that produces the desired output, call that function, save the result in a variable, and then pass the variable to the matlab function.
Linux shell 有管道運算符|
,這允許將 output 從一個命令轉發到第二個命令的輸入。 假設我們有 2 個 python 程序,a.py:
print(1)
print(2)
和 b.py:
i = int(input())
j = int(input())
print(i + j)
所以有了這兩個命令,你需要像這樣運行它們:
~> python3 a.py | python3 b.py
3
將此適應您的問題,第二個命令將是 matlab 程序,而不是 python3
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.