필터 지우기
필터 지우기

Matlab Function from code

조회 수: 1 (최근 30일)
marie lasz
marie lasz 2020년 9월 22일
답변: hatem 2023년 12월 27일
Hello Experts;
I am new in matlab and trying to learn how we can create function? For Example . I have this code how I can create function file out of it? It will be easy for me to learn from this code.
g=imread('cameraman.tiff');
original=g;
[m,n]=size(g);
subplot(2,2,1)
imshow(g,[])
[m,n]=size(g);
a = 3;
b = 3;
num_iter = 5;
for k=1:num_iter
for i=1:m
for j=1:n
r = mod([round(abs(1-(a*(i^4))+j)),round(abs(b*i))],[m n]);
x(i,j)=g(r(3)+1,r(4)+1);
end
end
g=x;
end
subplot(2,2,2)
imshow(x);

채택된 답변

Star Strider
Star Strider 2020년 9월 22일
See the documentation on Function Basics.
  댓글 수: 9
marie lasz
marie lasz 2020년 9월 22일
thanks for your suggestions and finally, I did it successfully and learned :-)
Star Strider
Star Strider 2020년 9월 22일
Our pleasure!
If my Answer helped you solve your problem, please Accept it!
.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

hatem
hatem 2023년 12월 27일
>> x =imread('cameraman.tif');
>> y = x*0;
>> [w h]= size(x);
>> for i = 1:w
for j =1:h
b =bitget(x(i,j),6)
y(i,j)=bitset(y(i,j),6,b);

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by