indexing in loop, cell

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by