User defined function error
Ältere Kommentare anzeigen
This is my user defined fumction
function color_val= color(y,x)
for j=1:3
red(j)=RGB(y,x,j);
end
color_val=red;
But i get this error:-
Error: File: connect.m Line: 153 Column: 1
Function definitions are not permitted in this context.
Akzeptierte Antwort
Weitere Antworten (1)
ES
am 24 Jan. 2014
Did you run the code in command window?
Matlab functions should be in m files, and as said above, the name of the function should be callable (i.e., the name of the file name should be same as the function.
Eg:
FileName is my_function.m
content of the file:
function ret_val=my_function(input1,input2)
ret_val=input1+input2;
then from command line you can call your my_function.
>> my_function(5,3)
8
Kategorien
Mehr zu Environment and Settings finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!