【问题标题】:Passing two values from one Matlab function to another in one line [duplicate]在一行中将两个值从一个 Matlab 函数传递到另一个 [重复]
【发布时间】:2016-11-08 02:30:32
【问题描述】:

我希望在一行中将双输出函数的输出传递给双输入函数。

即如果我有两个功能

function [out1, out2] = funA(in)
%function definition here
function out = funB(in1, in2)
%function definition here

我想做类似的事情

out = funB(funA(in)) %this doesn't actually work

是否有语法可以做到这一点而不必写成

[o1, o2] = funA(in)
out = funB(o1, o2)

我也不是在找

[o1, o2] = funA(in); out = funB(o1, o2);

【问题讨论】:

标签: matlab function


【解决方案1】:

我不确定这是否可能,因为如果您在另一个调用中内联调用该函数,Matlab 将始终假定您想要第一个/主要输出。

如果您实际分配其他输出变量(此处为 out2/in2),Matlab 只会创建它们。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-03
    • 1970-01-01
    • 2020-09-26
    • 2021-08-14
    相关资源
    最近更新 更多