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!