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 !


Log in to comment.

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);


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.

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

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.

Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!