简体   繁体   中英

multiple outputs from a function file

How can I get multiple outputs by running a function file. I wrote a function file which included set of codes to calculate 3 equations because of the same input images (its size is [4265,12789,7]) and catenate equation.

I need output images (.tif) with the same size as inputs from each equation. 3 outputs from 3 equations written in a function file. Is there any way to do this without separating each equation into different function files.

That is the convention for declaration:

function [y1,...,yN] = myfun(x1,...,xM)

and this is an example :

function [y1,y2] = average_and_sum(x)
if ~isvector(x)
    error('Input must be a vector')
end
y1 = sum(x)/length(x)
y2 = sum(x)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM