I have a function in Matlab that produces three specific results. I want to use these results as input arguments to a following function to calculate the end result.

How do I go about combining the two functions?

Not quite sure if I understand your question. As far as I understand you have a function1 that gives three output arguments that you want to use as inputs to a function2. In that case you could either just let the functions be separate and use them as

```
[a,b,c] = function1();
endResult = function2(a,b,c);
```

Or you could nest them by putting function1 within function2. You would do that by just appending function1 to the function2 file. In shell:

```
cat function2.m function1.m > function2.m
```

or just use an editor. You will have to edit the new function anyway, e.g. by adding the two Matlab code lines above just before defining function1.m.

Is that any help?

Not the answer you're looking for? Browse other questions tagged

.