How to call a function correctly.
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
dpb
il 11 Mag 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!