Hello. I need help with gui. 1) I have 2 pictures that I want to subtract and do not know how to code. The two images are open in two axes. The subtract will appear in a third axes. 2)have to move from string to double?
thank you very much!
No products are associated with this question.
String to double??? No. Just cast to floating point (so you won't get clipping at 0) and subtract:
diffImage = double(image1) - double(image2);
Of course you already have image1 and image2 or else you wouldn't have been able to display them in their axes.
I have this:
% --- Executes on button press in psr. psr_Callback function (hObject, eventdata, handles) diffImage = double (img0) - double (img90); axes (handles.ps1) image (diffImage)
There is an error that says:
?? Undefined function or variable 'img0'.
Error in ==> entornografico2> psr_Callback at 233 diffImage = double (img0) - double (img90);
Error in ==> gui_mainfcn at 96 feval (varargin {:});
Error in ==> entornografico2 at 42 gui_mainfcn (gui_State, varargin {:});
Error in ==> @ (hObject, eventdata) gui1 ('psr_Callback', hObject, eventdata, guidata (hObject))
?? Error while uicontrol Callback Evaluating
Thank you.
img0 is not in scope. You need to make it in scope - make it so that your callback can see it. See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.28s.29.3F
Please post comments/follow-up questions as comments to my Answer, not as Answers to your questions.
0 Comments