简体   繁体   中英

How can I create multiple inputs for a matlab function block?

I want to restrict the variable that I use as input for a matlab function block, it must be only able to increase. To achieve that i have tried to compare the variable and the previous sample of it in a matlab function, but i don't know how to create two inputs. To solve that i've tried to use a mux, but then i get an error. And google doesn't give me an explanation how to use a mux signal as input for a matlab function. So that leaves me here with this low-level question. Thanks in advance for your help and time. Cheers.

To use multiple variables in a function, you need to modify your function declaration at the first line of your function. The reference syntax is:

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

where x1 through xM are inputs. Your declaration with two inputs might look something like:

function [returnValue] = hasIncreased(previousSample, variable)

See the Matlab Function Documentation for more information.

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