Why this not works..?
3 次查看(过去 30 天)
显示 更早的评论
n = 10;
for p = 1:n
lal(p)
end
function [] = lal(p)
.
.
.
This method doesn't work.. Why..?
0 个评论
采纳的回答
Walter Roberson
2012-12-21
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 个评论
Image Analyst
2012-12-21
Then officially mark it as solved. Looks just like what Walter said except that the function name is different.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!