필터 지우기
필터 지우기

How to slove this scatterplot error

조회 수: 1 (최근 30일)
gfgf99
gfgf99 2015년 5월 31일
댓글: gfgf99 2015년 5월 31일
error appear like this _ _ _
Operands to the || and && operators must be
convertible to logical scalar values.
Error in scatterplot (line 60)
if ((fix(n) ~= n) || (n <= 0))
Error in Uzaaaazntitled (line 11)
scatterplot(cloud_cor,H);_ _ _
%code
T = [1 2 3 4];
A = [5 8 9 7];
H = [0.9965 0.2253 0.3698 0.4589];
for i=1:4
X=T(1,i);
Y=A(1,i);
% cloud_cor = [x_Tpoint y_Tpoint];
% scatterplot(cloud_cor,H);
end
cloud_cor = [X Y];
scatterplot(cloud_cor,H);

채택된 답변

dpb
dpb 2015년 5월 31일
It appears to be the Communications Toolbox scatterplot in which case according to the doc (and consistent with the error), a second input is defined as an integer decimation factor to use every Nth point of the input X. As used, the decimation isn't integer and so the testing for size as prelim for the subsetting fails. It would have been better it would appear for the function to do a little more error checking on inputs rather than just aborting, but that surely appears to be the cause.
I seems your intent here is some sort of plot in 2D space; scatterplot isn't up to the task Try scatter.
scatter(T.', A.',100*H,'filled')
xlim([0 5]),ylim([4 10])
I scaled up H to make the markers larger. NB: You don't need to use an array to rearrange vectors as column or row; use the transpose operator .' instead (note the difference in that ' by itself is complex conjugate transpose which is same result for real but not in general.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scatter Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by