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!