How I get this all values of regionprops and show in diferent edit texts in my GUI?
조회 수: 4 (최근 30일)
이전 댓글 표시
stats = regionprops('table',CloseBW,'Area',...
'BoundingBox',...
'Centroid',...
'EquivDiameter',...
'MajorAxisLength',...
'MinorAxisLength',...
'Perimeter')
댓글 수: 0
채택된 답변
Walter Roberson
2017년 11월 16일
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
Image Analyst
2017년 11월 16일
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
2017년 11월 17일
set( handles.Areas, cellstr( num2str([stats.Area]) ) )
추가 답변 (2개)
Image Analyst
2017년 11월 16일
You could try sprintf(). For example
allAreas = [stats.Area];
handles.text1.String = sprintf('%d, ', allAreas);
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!