matlab中for循环保存循环内部的数据
i=10;sum=0;Sdata=zeros(i,1);form=1:isum=sum+1;Sdata(:,1)=sum;%保存的是10,不是1,2,3,4,5,6,7,...
i = 10;
sum = 0;
Sdata = zeros(i,1);
for m = 1:i
sum = sum + 1;
Sdata(:,1) = sum; %保存的是10,不是1,2,3,4,5,6,7,8,9,10
end 展开
sum = 0;
Sdata = zeros(i,1);
for m = 1:i
sum = sum + 1;
Sdata(:,1) = sum; %保存的是10,不是1,2,3,4,5,6,7,8,9,10
end 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询