花括号{}的数据类型是cell
numlist={3,6,18}
for k1 = 1:length(numlist)
fprintf('Number at position %d = %6.2fn', k1, numlist{k1})
end
中括号[]的数据类型是array
v=[1,4,6,4,1];
s=0;
for i=1:length(v)
s=s+v(i);
end
disp(s);
最后
以上就是调皮便当最近收集整理的关于matlab遍历cell和array的for循环写法的全部内容,更多相关matlab遍历cell和array内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复