Why only scatter function is not working?
Show older comments
x=27:0.5:29
y= [2.41 2.4 2.395 2.39 2.38]
scatter(x,y)
scatter plot is not showing by using thus code.Please clarify.
10 Comments
It's working here.
x=27:0.5:29;
y= [2.41 2.4 2.395 2.39 2.38];
scatter(x,y)
What is the output for you?
Walter Roberson
on 11 Oct 2023
Did you accidentally create a variable named scatter?
dpb
on 11 Oct 2023
Type
clear scatter
at command line and all trouble will (almost certainly) disappear! :)
It's what all the above were driving at -- you undoubtedly accidentally created a variable scatter the is aliasing the function.
If you created another m-file function by the name of scatter, that would do it, too, but that's much less likely -- but the which would show it up. In that case, of course, if it is a function you need/want, then rename it something like "myscatter.m" or, if it was an accident, just delete it.
Bruno Luong
on 12 Oct 2023
If scatter was a variable accidently created then scatter(x,y) would throw an error. So I don't think this is the case.
Walter Roberson
on 12 Oct 2023
You are correct that with non-integer x and y and if scatter was a numeric variable (most types of variables actually) then scatter(x,y) would generate an error. (But there are some places it would not, such as if scatter happened to be a function handle with 2 parameters)
However... I have seen in the past that people have said that an output is "not showing" (or similar wording about not seeing the output) when the code was generating error messages. People do not always notice the error messages, or do not always think they are significant.. or sometimes they just don't mention error messages that look pretty significant, expecting that we will immediately know the error message just be reading their code...
GD
on 12 Oct 2023
GD
on 12 Oct 2023
GD
on 12 Oct 2023
GD
on 12 Oct 2023
Accepted Answer
More Answers (0)
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



