How to create user defined function in matlab?
Afficher commentaires plus anciens
I have use below set of code frequently. So i have to make user defined function
below is my frequently used code:-
x=xvalue;
y=yvalue;
for j=1:3;
red(j)=RGB(y,x,j);
end
shape.color=red;
2 commentaires
Azzi Abdelmalek
le 22 Jan 2014
Can you explain what are the argument (inputs and outputs) of your function?
saravanakumar D
le 22 Jan 2014
Modifié(e) : saravanakumar D
le 22 Jan 2014
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 22 Jan 2014
function shape = myFunction(RGB, xvalue, yvalue, i)
shape(i).color = squeeze(RGB(xvalue, yvalue, :));
2 commentaires
saravanakumar D
le 22 Jan 2014
Walter Roberson
le 22 Jan 2014
The output variable is "shape", as listed in the function header. The "shape" that is output will be a structure array with a single field "color", with the "i"th element of the structure array populated with meaningful data and the rest of the shape(K).color will be the empty array []
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!