How to return loop result (string) from an mfile to another mfile(editText GUI)?
Show older comments
I have two mfiles. One mfile (gui.m) is gui with buttons (for browse and result) and edittext component. another mfile (function.m) with looping function. when i run function.m, i want to return the result to edittext in gui.m
in function.m:
function a = function (f)
i=f; %i is browsed image from gui.m
%this loop result that i want to call to edittext
w=[];
k=0;
for ...
w=[a b];
k=k+1;
end
end
a=w; %to return the result a as w
in gui.m:
function resultButton_Callback(hObject, eventdata, handles)
set(handles.edit5);
covImg= handles.covImg; %covImg is browsed image
G = function(covImg); %call function.m
guidata(hObject,handles);
handles.covImg = G;
imshow(handles.covImg);
looking forward for any response. thanks in advance.
4 Comments
Geoff Hayes
on 5 Jul 2015
Edited: Geoff Hayes
on 5 Jul 2015
Ria - please clarify what you want to show in the edit text box. The result of function appears to be an array (or image) which you save to the covImg field of the handles structure which you then display using imshow. What then do you want to display in the edit text box?
I realize that you have probably only posted pseudo code in your question, but you should name your function appropriately so that the reader can get an idea of what it is doing and what it will return.
Ria Anggraini
on 8 Jul 2015
Edited: Ria Anggraini
on 9 Jul 2015
Guillaume
on 8 Jul 2015
This is completely aside from your question, but if your function is truly called function.m, I strongly suggest you to rename it. I'm surprise that matlab actually lets you use that name since it is a reserved keyword.
A good name for a function is something that actually describes what it does.
Ria Anggraini
on 9 Jul 2015
Accepted Answer
More Answers (0)
Categories
Find more on Interactive Control and Callbacks 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!