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

1 visualizzazione (ultimi 30 giorni)
Emre Tutucu
Emre Tutucu il 5 Giu 2020
Commentato: Image Analyst il 6 Giu 2020
How ı can write a function and sub function.
Can you give me an example ?

Risposte (2)

David Hill
David Hill il 6 Giu 2020
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 Commento
Emre Tutucu
Emre Tutucu il 6 Giu 2020
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

Accedi per commentare.


David Hill
David Hill il 6 Giu 2020
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 Commenti
Emre Tutucu
Emre Tutucu il 6 Giu 2020
i did already
Image Analyst
Image Analyst il 6 Giu 2020
Then attach all needed files so we can run them ourselves.

Accedi per commentare.

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by