如何捕捉从在MATLAB函数的输出? [英] How to capture an output from a function in MATLAB?

查看:109
本文介绍了如何捕捉从在MATLAB函数的输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的函数

 函数增长(百分比,数量)    低=数 - 数*个百分点;结束

我要回低,所以我可以用它作为其他功能

参数

 有丝分裂原(ASP,阿根廷,增加(0.2,234),GLU)

有没有办法做到这一点?


解决方案

这样:

 功能低下=上涨(百分比,数量)
  低=数 - 数*个百分点;
结束

您也可以有一个以上的东西等号左边的返回多个项目

 函数[OUT1,OUT2] = foo的(酒吧,巴兹)

I have a simple function

function increase(percent, number)

    low = number - number*percent;

end

I want to return low so I can use it as an argument for another function

mitoGen(asp, arg, increase(0.2, 234), glu)

Is there a way to do this?

解决方案

As such:

function low = increase(percent, number)
  low = number - number*percent;
end

You can also return multiple items by having more than one thing to the left of the equal sign:

function [out1, out2] = foo(bar, baz)

这篇关于如何捕捉从在MATLAB函数的输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆