How output data from one m-file as an input variable in another m-file

Home Forums Matlab How output data from one m-file as an input variable in another m-file

This topic contains 1 reply, has 2 voices, and was last updated by  cK 10 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #483

    pankaj kumar
    Participant

    I have two function file in which second file depends upon output variable of first file. May I know how I can use output data from one m-file as an input variable in another m-file?

    #484

    cK
    Keymaster

    [x,y,z,...] = firstfunction(…);
    [a,b,c..] = secondfunction(x,y,z,…);
    elipsis indicates you can have as many variables for input/output as required.

    If there are too many variables that secondfunction() requires from firstfunction(), you may try one of the following:
    1. fusing the two functions into one
    2. make both the functions scripts so that variables created in base workspace by first script can be used by second script when called in succession.
    3. global variables

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.