MATLAB Answers


how to calculate "statmoments" and "statxture" of an image by using MATLAB GUI ?

Asked by Alisina
on 19 Jan 2013

Hi, i have two m files in order to calculate STATMOMENTS & STATXTURE of an image. [*statmoments.m & statxture.m*]. the statmoments m file is inside the statxture m file. i need to make a pushbotton with text boxes to display my result of the m files in them. so, the question is HOW TO USE THOES M FILES IN PUSH BOTTON ? AND DISPLAY THE RESULTS IN TEXT BOXES ?

thanks for your time and helping !


1 Answer

Answer by Image Analyst
on 19 Jan 2013

See this:

You can find out how to use GUIDE to build a GUI and put code in so that when you click a button your code executes. You can also use sprintf() and set() to put text onto the GUI in a text control.

% Make a string.
theText = sprintf('Your number = %.3f', theNumber);
% Now, send it to the text control.
set(handles.text1, 'String', theText);


on 31 Jan 2013

thanks a lot for your time to answer my question. i succeed to find the statxture value. now i am going to display those values in a text box. so my question is how to display a number to text box ? can you please guide me with an example ? any reference ? really thanks a lot.

Image Analyst
on 31 Jan 2013

That's what the last portion of my answer shows you. Did you put that code into your function?

on 13 Feb 2013

wow....i did it:)))) so happy.^_^ i really appreciate your time and kindness to help me. God bless you.

i have another question : i am going to use if/else/then to compare two static boxes together which contains value . and then display the result in sentence form in my GUI.

lets say, first static box contains number 1 and the second static box contain number 2 ... so i am going to write a if/else/then syntax to compare them, and then display in my GUI that 2 is bigger than 1.... can you please guide me on this as well ? really thanks a lot.

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today