How to call a function correctly.
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to implement a forward-backward splitting problem onto matlab. I have got the following code so far:
function [iflowers]=flower_image()
RGB=imread('...flowers image.jpg');
flowers=double(rgb2gray(RGB));
alpha=0.05;
iters=1000;
iflowers=do_flower_image(flowers,alpha,iters);
end
but when I call
[phi_x,phi_y]=do_flower_image(flowers,alpha,iters)
when creating a new function, then it doesn't work.
I believe this is due to the call of the do_flower_image not matching with the outputs of the function but I am new to matlab and I don't really understand what this means?
I have read all the help for creating and calling functions but it hasn't really made it any clearer for me.
0 commentaires
Réponse acceptée
dpb
le 11 Mai 2017
[phi_x,phi_y]=do_flower_image(flowers,alpha,iters)
Well, if
iflowers=do_flower_image(flowers,alpha,iters);
worked (or at least didn't error) and the error in the other call is "too many outputs" or somesuch, then the function do_flower_image is written to output only one variable and you've asked for two.
The documentation/help for that function will explain what it does and its inputs/outputs; we can't know that...
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!