How to slove this scatterplot error
3 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Scatter Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!