How do I call functions in MATLAB using an m-file?

  • Thread starter Thread starter satinysol
  • Start date Start date
  • Tags Tags
    Function Matlab
satinysol
Messages
14
Reaction score
0
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
 
Physics news on Phys.org
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.
 
Joffan said:
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.

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 ?
 
sounds reasonable. What's the issue?
 
Joffan said:
sounds reasonable. What's the issue?

It works now. ^^
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K