How do I fix the error Function definitions are not permitted at the prompt or in scripts.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
whenever I write the command function imageChoice_callback(hObject,eventdata). Encounter an error Function definitions are not permitted at the prompt or in scripts. please suggest me how do i fix it.
0 comentarios
Respuestas (2)
Sean de Wolski
el 12 de Dic. de 2011
Write in in an editor file and save it as the title of function, e.g:
function hello_world(hObject,evt)
fprintf(2,'Hello World!');
end
saved in hello_world.m
3 comentarios
Walter Roberson
el 12 de Dic. de 2011
Apply the solution Sean gave: write the sections that start with "function" into individual files.
The part before the first "function" line should be written into EZresize.m
Fangjun Jiang
el 12 de Dic. de 2011
Editada: John Kelly
el 26 de Feb. de 2015
The message said so. You are not allowed to define a function in the command line or in a script file.
You need to create a separate .m file, where the first line, you define "function imageChoice_callback(hObject,eventdata)" and then save the file as imageChoice_callback.m.
Or, the function name sounds like belonging to a .m file for a GUI application. You should add this function in the .m file for that GUI application. The first line of that .m file should also be a "function ..." line. Otherwise, that .m file is called a script. You are not allowed to define a function in a script.
1 comentario
Daniel Shub
el 12 de Dic. de 2011
What about your other campaign ..
http://www.mathworks.com/matlabcentral/answers/7691-please-vote-if-you-do-not-want-to-have-m-function-in-m-script
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!