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

1 回表示 (過去 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 Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by