How to slove this scatterplot error
4 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
dpb
on 31 May 2015
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.
More Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!