简体   繁体   English

如何将一个函数的输出值用作另一个MATLAB的输入

[英]How to use output values of one function as input of another MATLAB

How would I go about using and assigning the values of my getValidArgs output into the input of my processArgs function. 我将如何使用getValidArgs输出的值并将其分配到processArgs函数的输入中。 At the moment I have been able to get it to work somewhat but when I go to use one of the assigned values n,mu or sigma it says that the value is undefined. 目前,我已经能够使其工作,但是当我使用分配的值n,mu或sigma中的一个时,它表示该值未定义。 I will attach my code and the question I am trying to complete. 我将附上我的代码和我要完成的问题。

Thanks for your help. 谢谢你的帮助。

function [n, mu, sigma] = getValidArgs( varargin )
[n, mu, sigma] = processArgs( varargin );
end

function [n, mu, sigma] = processArgs( args)

%args cell array

% Number of elements in arg less than 3
if length( args)<3
error('Required input for n, mu and sigma not provided')
end

end 结束

This should be what you are looking for: 这应该是您要寻找的:

function [n,mu,si] = getValidArgs(a,b,c)

[n,mu,si] = processArgs(a,b,c);

end
function processArgs(varargin)

if length(varargin)
    error('edagagag')
end

if isscaler(varargin{1})||iscalar(varargin{2})||isscalar(varargin{3})
else
    error('dagdgg')
end
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在另一个函数中使用matlab函数的输出? - How to use the output of matlab function in another function ? 如何使用一个函数的输出变量作为另一个函数的输入 - How to use output variables of a function as input for another function matlab,如何使用函数输出的输出? - matlab, how to use the output that is printed by a function? 将输出用作Simulink中Matlab功能块的新输入 - Use the Output as the New Input into Matlab Function block in Simulink 在同一个Simulink模型中,如何使用matlab函数的输出向量作为查找表的输入? - How to use the output vector of a matlab function as an input for a lookup table in the same Simulink model? 是否可以在MATLAB的另一函数中使用一个用户定义的函数? - Is it possible to use one user defined function in another function in MATLAB? 矩阵作为Matlab函数的输入和输出 - Matrix as input and output of Matlab function Matlab:如何在函数中使用矩阵的所有值 - Matlab: How to use all the values of a matrix in a function 我如何编写名为dedbi的MATLAB函数,该函数将输入xtx作为字符串并返回另一个字符串xtxx作为输出。 - How can i write a MATLAB function named dedbi that takes input xtx as string and returns another string xtxx as output. 如何使用 python output 作为 matlab 输入? - How can I use a python output as a matlab input?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM