MATLAB 帮助中心
用来重复指定次数的 for 循环
for
for index = values statements end
index
values
statements
for index = values, statements, end 在循环中将一组语句执行指定的次数。
for index = values, statements, end
如果 colon, : 运算使用 fi 对象作为索引,则 fi 对象必须为整数。
colon, :
fi
有关详细信息,请参考 MATLAB® for 参考页。
示例
全部折叠
使用 fi 对象作为 for 循环的索引。
a = fi(1,0,8,0); b = fi(2,0,8,0); c = fi(10,0,8,0); for x = a:b:c x end
x = 1 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
x = 3 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
x = 5 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
x = 7 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
x = 9 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 8 FractionLength: 0
全部展开
在 R2014b 中推出
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处