Solve looping for big cell, vector, and summation
2 次查看(过去 30 天)
显示 更早的评论
I have Z, Z is cell (1*1000) and for i=1:1000 size(Z{i}) is 1*1008
I need to do the summation until 1000, start from 1, i can do it manually but it will be long until 1000.
The code is like this,
p1=sum(reshape(Z{1},[],4),1) %Z{1} is 1*1008, from 1008 column reshape to 4 column
%4*column1
%5*column2
%6*column3
%7*column4
for i=1:4
f=(i+3)*p1(i) % x*p(x)
h(i)= f %size(1*4)
end
sum(h)
Repeat,
p2=sum(reshape(Z{2},[],4),1)
%8*column1
%9*column2
%10*column3
%11*column4
for j=1:4
f=(j+7)*p1(j) % x*p(x)
h(j)= f %size(1*4)
end
sum(h)
How to create a looping until p1000?
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!