Why this not works..?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
n = 10;
for p = 1:n
lal(p)
end
function [] = lal(p)
.
.
.
This method doesn't work.. Why..?
0 commentaires
Réponse acceptée
Walter Roberson
le 21 Déc 2012
What does not work about it? What error message is given?
One thing I notice is that in the code you show, if that is the entire code, then you are attempting to define a function inside a script. You need to convert the first part to a function. For example,
function testloop
n = 10;
for p = 1 : n
lal(p)
end
function [] = lal(p)
...
4 commentaires
Image Analyst
le 21 Déc 2012
Then officially mark it as solved. Looks just like what Walter said except that the function name is different.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!