Why only scatter function is not working?
Ältere Kommentare anzeigen
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 Kommentare
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
am 11 Okt. 2023
Did you accidentally create a variable named scatter?
dpb
am 11 Okt. 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
am 12 Okt. 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
am 12 Okt. 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
am 12 Okt. 2023
GD
am 12 Okt. 2023
GD
am 12 Okt. 2023
GD
am 12 Okt. 2023
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Scatter Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




