Somehow all interactive use of fplot and all of my codes that use fplot get this Error:
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Error: File: fplot.m Line: 65 Column: 5 Function definitions in a script must appear at the end of the file. Move all statements after the "searchLinespec" function definition to before the function definition.
I cant even open MATLAB and enter fplot(@(x) sin(x))
0 commentaires
Réponses (1)
Steven Lord
le 10 Avr 2017
Are you sure you're using the fplot function included in MATLAB? Use this command to check that you're not calling a different fplot function.
which -all fplot
If you are using the function in MATLAB, make sure you haven't modified that function. If you have, hopefully you made a backup copy and can restore it to its original state using that backup (or can undo the modifications you made.)
2 commentaires
Steven Lord
le 10 Avr 2017
So that suggests to me that you have edited fplot.m and commented out the first line of the code. Open the file in the MATLAB Editor (DON'T change anything yet!) and look in the upper-right corner of the Editor window. Is the box there green (it should be) or red (I suspect it will be)? If it's red, check if the first line is a comment line (it shouldn't be, but I suspect it is) or the uncommented function declaration line (it should be.)
If it's the function declaration line "function varargout = fplot(varargin)" but is commented out, uncomment it.
If it is "%FPLOT Plot 2-D function", you deleted the function declaration line and should add the function declaration line back.
If it's something else, there's something else going on and you should probably work with Technical Support (use the Contact Us link at the top of this page) to correct the problem.
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!