indexing in loop, cell

1 vue (au cours des 30 derniers jours)
Tomas
Tomas le 30 Nov 2013
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.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Déc 2013
Before the first
for j=1:length(Z{i})
add
odch = [];

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by