What is meant by Error: Function definitions are not permitted in this context?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
NORLITA ADIANA
am 25 Mär. 2016
Kommentiert: DHANA VADRA
am 3 Mai 2020
Greets! I am using MATLAB for my Final Year Project. I just want to ask what is meant by Error: Function definitions are not permitted in this context. This is the first part of the coding. It says that function facetest | Error: Function definitions are not permitted in this context.

I already save the file as facetest.m and it appear the same error. Can anyone teach me how to solve this problem? Thanks
0 Kommentare
Akzeptierte Antwort
Star Strider
am 25 Mär. 2016
The error means that you are not permitted to define a function file inside a script file. Create your ‘facetest’ as a separate file in the MATLAB Editor(open a new tab) and then save it as facetest.m. See the documentation on Function Basics for details.
2 Kommentare
Weitere Antworten (1)
DHANA VADRA
am 3 Mai 2020
function w=string_swap(v)
w=[];
x=length(v);
for i=1:x
j=i;
w(j)=v(i);
end
eventhogh iam submitting above program with name string_swap.m.it is showing the same error as undefined function or variable v if iam using run option.but if i run it in command window it is running
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!