Trouble getting function to work. Not enough inputs.
Ältere Kommentare anzeigen
I'm trying to write a function that will output the indices of all local maxima and minima of a function. I was able to write code to do so but not within a function. I have this:
function [maxima,minima] = min_max(y)
maxx = islocalmin(y);
minn = islocalmax(y);
maxima = find(maxx == 1);
minima = find(minn == 1);
end
If i just use the code inside the function it does exactly what I want it to but I'm having trouble getting the function to work properly. The error I'm getting is not enough input arguments. Any advice on how to get this function to execute?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Image Arithmetic finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!