About sub function............

조회 수: 4 (최근 30일)
Emre Tutucu
Emre Tutucu 2020년 6월 5일
댓글: Image Analyst 2020년 6월 6일
How ı can write a function and sub function.
Can you give me an example ?

답변 (2개)

David Hill
David Hill 2020년 6월 6일
function out=showMe(in)
n=1;
out=executeSub();
function o=executeSub()%I assume you are talking about a nested function
o=5*n;
end
end
Look at matlab help: Nested Functions
  댓글 수: 1
Emre Tutucu
Emre Tutucu 2020년 6월 6일
thanks but im trying this code its didnt work. what is wrong?
clc;
clear;
function Soru6
aci=input('Lütfen açıyı giriniz : ');
F=input('Lütfen kuvveti giriniz : ');
mesnet
function mesnet
y=aci*F
fprintf('%g',y);
end
end

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


David Hill
David Hill 2020년 6월 6일
function Soru6
aci=input('Lütfen açıyı giriniz : ');
F=input('Lütfen kuvveti giriniz : ');
mesnet
function mesnet
y=aci*F
fprintf('%g',y);
end
end
Works just fine but you still need to execute it.
Soru6;
  댓글 수: 4
Emre Tutucu
Emre Tutucu 2020년 6월 6일
i did already
Image Analyst
Image Analyst 2020년 6월 6일
Then attach all needed files so we can run them ourselves.

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by