Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.