How to call a function correctly.
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
dpb
on 11 May 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 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!