1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Calling function im matlab?

  1. May 15, 2012 #1
    I have to make an m-file that asks the user to input two values.

    Then it performs a series of functions and returns an answer.

    I have made the functions (each in their own m-file)

    But I don't understand how you call functions using an m-file. I have to have one main m-file which calls all the functions so it can give an answer to the user...

    Please help me ,thx
  2. jcsd
  3. May 15, 2012 #2
    You just call the functions by their names as defined on the top line of the file. Post an example of one of your functions.
  4. May 15, 2012 #3
    I want to call this function function varargout = peakfinder(x0, sel, thresh, extrema) which need me to input x0.

    the command for running this function is [peakMag,peakloc]=peakfinder(x0) which can let me get the values of peakMag and peakloc.

    then i wrote my own m.file and need to use this function to get peakMag and peakloc of my data , can i just use [peakMag,peakloc]=peakfinder(smootherwavedata); to get the values ?
  5. May 16, 2012 #4
    sounds reasonable. What's the issue?
  6. May 17, 2012 #5
    It works now. ^^
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook