How to create user defined function in matlab?
이전 댓글 표시
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
Azzi Abdelmalek
2014년 1월 22일
Can you explain what are the argument (inputs and outputs) of your function?
saravanakumar D
2014년 1월 22일
편집: saravanakumar D
2014년 1월 22일
채택된 답변
추가 답변 (1개)
Walter Roberson
2014년 1월 22일
function shape = myFunction(RGB, xvalue, yvalue, i)
shape(i).color = squeeze(RGB(xvalue, yvalue, :));
댓글 수: 2
saravanakumar D
2014년 1월 22일
Walter Roberson
2014년 1월 22일
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 []
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!