필터 지우기
필터 지우기

Plot in MATLAB app desinger not working

조회 수: 1 (최근 30일)
Sam Schiavitti
Sam Schiavitti 2021년 12월 6일
댓글: Walter Roberson 2021년 12월 6일
Hello, every time I try to plot this in matlab app desinger it does not work. Any explanation why? The plot just shows up as white.
global image;
horDim = app.HorizontalDimensionsEditField.Value;
vertDim = app.VerticalDimensionsEditField.Value;
dropDistance = app.DropDistanceEditField.Value;
diameter = app.DiameterEditField.Value;
processingImage = image;
if ndims(processingImage) > 2; processingImage = rgb2gray(processingImage); end
BW = imbinarize(processingImage);
BW = imresize(BW, [horDim,vertDim]);
Goal = flip(BW);
writematrix(double(Goal), 'Standard.xlsx');
writematrix(double(~Goal), 'Reverse.xlsx');
for i = 1:1:horDim
for j = 1:1:vertDim
if(Goal(i,j) == 1)
xvalue = j*dropDistance;
yvalue = i*dropDistance;
plot(app.UIAxes2, xvalue, yvalue);
hold(app.UIAxes2)
else
xvalue2 = j*dropDistance;
yvalue2 = i*dropDistance;
plot(app.UIAxes2, xvalue2, yvalue2);
pause(.005)
end
end
end

답변 (1개)

Walter Roberson
Walter Roberson 2021년 12월 6일
plot() only draws lines if you supply at least two adjacent finite coordinates in a single call. However you are passing in scalar values so no lines are drawn.
By default markers are not drawn when you use plot(). If you want to plot() one point at a time be sure to specify the marker type in the call.
  댓글 수: 2
Sam Schiavitti
Sam Schiavitti 2021년 12월 6일
This helps to show the very last plot though it only plots the last one. How do I plot all indices?
Walter Roberson
Walter Roberson 2021년 12월 6일
The hold call you coded is toggling hold every time it is called. you need to add 'on' as a parameter to the call

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Object Properties에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by