フィルターのクリア

How can I preallocate it?

2 ビュー (過去 30 日間)
Ayob
Ayob 2013 年 5 月 3 日
I want preallocate GGP{F} in my program. How can I do it?
%
for F=1:PE*AE*RE
GGP{F}=zeros(2,12);
for i=1:12
n=0;
[GGP{F}(2,i),GGP{F}(1,i)]=cart2pol(GG{F}(1,i),GG{F}(2,i));
for j=1:NodesTETA*NodesR*NodesZ
if abs((GGP{F}(1,i)-p{j}(1))/Radiale)<1 && abs((GGP{F}(2,i)-p{j}(2))/peripherale)<1 && abs((GG{F}(3,i)-p{j}(3))/Axiale)<1
n=n+1;
NODZ{F,i}(n)=j;
end
end
end
end
  1 件のコメント
James Tursa
James Tursa 2013 年 5 月 3 日
What's going on with your cart2pol call? Looks like you are always passing it 0's.

サインインしてコメントする。

回答 (1 件)

James Tursa
James Tursa 2013 年 5 月 3 日
編集済み: James Tursa 2013 年 5 月 3 日
GGP = cell(1,PE*AE*RE);
You could move the GGP{F}=zeros(2,12) stuff outside the loop as well, but it wouldn't save you anything to do so, so I would leave that where it is.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by