Repeat calculation 24 times (Cell arrays)
1 回表示 (過去 30 日間)
古いコメントを表示
I have to repeat a calculation 24 times and store the results. I have written the code for the first column. How do I repeat it 24 times for each column.
p=[0.1,0.5,1,2.5,5,10,25,50,75,90,95,97.5,99,99.5,99.9];
for i=1:50
for j=1:500000
stress(j,i)=E(i,1)*D(j,1);
end
end
for k=1:15
for i=1:50;
Stressperc(k,i)=prctile(stress(:,i),p(1,k));
end
end
1 件のコメント
Walter Roberson
2025 年 4 月 7 日
Note that more efficient would be
p=[0.1,0.5,1,2.5,5,10,25,50,75,90,95,97.5,99,99.5,99.9];
for i=1:50
stress(:,i) = E(i,1) .* D(:,1);
end
Stressperc = prctile(stress, p);
採用された回答
Walter Roberson
2025 年 4 月 7 日
p=[0.1,0.5,1,2.5,5,10,25,50,75,90,95,97.5,99,99.5,99.9];
Stressperc = zeros(numel(p), 50, 24);
for col = 1 : 24
for i=1:50
stress(:,i) = E(i,1) .* D(:,col);
end
Stressperc(:,:,col) = prctile(stress, p);
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!