Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-05-17
帖子: 5
声望力: 0 ![]() |
![]()
我是初学者,有一个问题想请教大家。
在循环嵌套中的内循环的的for 语句中能不能包含父循环for 语句中的循环指数? 例子: clear all; x = input('entrer un chiffre entier impair : '); if mod(x,2)==0 fprintf('%.0f n''est pas un chiffre entier impair \n',x); else str_space=''; for k=1 ![]() for n=1:1 ![]() str_space=strcat(str_space,' '); end for n=1 ![]() str_etoile=strcat(str_etoile,'*'); end str_result=[str_space str_etoile str_space]; fprintf('%s \n',str_result); end end 系统说“for n=1:1 ![]() |
![]() |
![]() |