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!