How I get this all values of regionprops and show in diferent edit texts in my GUI?
    3 views (last 30 days)
  
       Show older comments
    
    Marlon Damaceno
 on 16 Nov 2017
  
    
    
    
    
    Commented: Walter Roberson
      
      
 on 17 Nov 2017
            stats = regionprops('table',CloseBW,'Area',...
                                    'BoundingBox',...
                                    'Centroid',...
                                    'EquivDiameter',...
                                    'MajorAxisLength',...
                                    'MinorAxisLength',...
                                    'Perimeter')
0 Comments
Accepted Answer
  Walter Roberson
      
      
 on 16 Nov 2017
        set( handles.Areas, cellstr( str2num(stats.Area) ) )
This would require that handles.Areas is a uicontrol style text or style edit whose Max property has been set to 2 or more so that it will expect multiline inputs.
Have you considered outputting to a uitable instead of to individual edit fields? You could use table2cell() to make it easier.
3 Comments
  Image Analyst
      
      
 on 16 Nov 2017
				Huh?
set( handles.Areas, cellstr( str2num(stats.Area) ) )
doesn't work. For one thing, stats.Area is already a number if there's just a single blob so it can't be passed into str2num. And if there are several structures (blobs), then it gets even worse.
My code below works beautifully, even for multiple blobs.
  Walter Roberson
      
      
 on 17 Nov 2017
				set( handles.Areas, cellstr( num2str([stats.Area]) ) )
More Answers (2)
  Image Analyst
      
      
 on 16 Nov 2017
        You could try sprintf(). For example
allAreas = [stats.Area];
handles.text1.String = sprintf('%d, ', allAreas);
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

