How to capture an output from a function in MATLAB?

徘徊边缘 提交于 2020-01-15 12:44:39

问题


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?


回答1:


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)


来源:https://stackoverflow.com/questions/2908753/how-to-capture-an-output-from-a-function-in-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!