Diplaying values in GUI

2 views (last 30 days)
Rob
Rob on 27 Apr 2012
Hello,
I am creating my first simple GUI using matlab in which I uplaod an image, calculte its max R, G, B values and display them. I have a load push botton which works fine and a second one for calculating the maximum R,G and B values. What I want to do is to have the values displayed in three separate 'static text'buttons and below the callback function i used:
function DisplayValues_Callback(hObject, eventdata, handles)
set(handles.Rvalue, 'string',Rmax);
set(handles.Gvalue, 'string',Gmax);
set(handles.Bvalue, 'string',Bmax);
Unfortunately, it did not work, anyone can help me out please. Thank you very much. Remy

Accepted Answer

Sean de Wolski
Sean de Wolski on 27 Apr 2012
Rmax, Gmax and Bmax have to be strings. If the are represented as numbers, use num2str() to convert to string:
doc num2str
and
set(handles.Bvalue, 'string',num2str(Bmax));
  3 Comments
Image Analyst
Image Analyst on 27 Apr 2012
WHERE are they calculated? If they aren't calculated inside that function, they won't be seen. Please copy the error message (all the red text) so we can see what "didn't work" means. I suspect it will say Rmax is undefined.
Rob
Rob on 27 Apr 2012
I just had it working and read your answer.
Is what I did, I included the calculation in the DisplayVAlues function. In fact,I wrote a code that does various processing to the image. When representing them in a GUI it is not as straight forward as putting each process in diffent callback function.
So my question is how do I link the result of one function to
the next one? i.e:
1st function: I read 1st image and apply so stuff to it, I extract parameters,
2nd function: use the above parameters and apply them to another image,
3rd function: call for a 3rd image and run some convolution the above too image
ect ...
Many thanks for your help!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!