indexing in loop, cell

1 回表示 (過去 30 日間)
Tomas
Tomas 2013 年 11 月 30 日
回答済み: Walter Roberson 2013 年 12 月 1 日
I have cell Z
in cell Z{1}=
Columns 1 through 6
[1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double] [1x3 double]
Column 7
[1x3 double]
Z{2}= [1x3 double] [1x3 double]
MAXP= (max count object in cell Z{1} have 7 object
Z{2} have 2 oject)
MAXP=1
my code:
for i=1:size(Z,2)
if length(Z{i})>MAXP
for j=1:length(Z{i})
a=([Z{i}{j};M(i,:)]);
odch(j,:)=std(a);
end
odch
maxval=max(max(odch));
[i_max,j_max]=find(odch==maxval);
for j=1:length(Z{i})
for c=1:length(Z{i}{j})
if j==i_max && c==j_max
value=Z{i}{j}(c)
end
end
end
number=value/2
W={};
for j=1:length(Z{i})
if all((Z{i}{j})>number)
W{i}{j}=Z{i}{j};
else
W{i+1}{j}=Z{i}{j};
end
end
end
end
W
When i have size(Z,2)=2, I dont know how I then index W to me it do not overwrite.
I need overwrite the variable odch.

採用された回答

Walter Roberson
Walter Roberson 2013 年 12 月 1 日
Before the first
for j=1:length(Z{i})
add
odch = [];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by