How do I fix the error "Function definitions are not permitted at the prompt or in scripts"?
Mostra commenti meno recenti
I get an error when I type this:
function S = timestr(D,precision)
Here is the error:
Error: Function definitions are not permitted at the prompt or in scripts.
What does it mean?
1 Commento
Jan
il 27 Mag 2011
After you've edited the text, your question is clearer. And you type this in the command line? Do you want to create the function or do you have a file called "timestr.m" already?
Risposte (2)
Ben Mitch
il 27 Mag 2011
Perhaps where you have
function S = timestr(D,precision)
you intended
S = timestr(D,precision)
1 Commento
Fangjun Jiang
il 27 Mag 2011
No. More likely is the case that Jan described.
Jan
il 27 Mag 2011
2 voti
Is timestr a script file? Then the message is clear: A script file cannot contain function definitions.
See also:
1 Commento
Fangjun Jiang
il 27 Mag 2011
Aha, those posts have some use after all!
Categorie
Scopri di più su Logical in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!