Thread Subject: cell array,for loop

Subject: cell array,for loop

From: Guangping Zhang

Date: 10 Mar, 2010 15:21:05

Message: 1 of 2

Dear all:
     I really need help.
    So I post it again, because the first post is too messy, so I delete some statement in this version.

     I can run an iteration below well,

    n=length(c{1}-1);
    decay=ones(n,3);
for i=1:n
    k=c{1}(i,3);
    x=cT{1}(k:k+1000,1); Y=cT{1}(k:k+1000,2);
end


But after I put the iteration above into another iteration below, it doesn't.
The problem is 'x=...; Y=...' sentence below:
 
for j=1:5
    n=length(c{j}-1);
    decay=ones(n,3);
  for i=1:n
    k=c{j}(i,3);
    x=cT{j}(k:k+1000,1); Y=cT{j}(k:k+1000,2);
  end
end

Any help will be welcome.

Subject: cell array,for loop

From: Jan Simon

Date: 11 Mar, 2010 10:37:06

Message: 2 of 2

Dear Guangping!

> I really need help.
> So I post it again, because the first post is too messy, so I delete some statement in this version.
>
> I can run an iteration below well,
> ...
> But after I put the iteration above into another iteration below, it doesn't.
> The problem is 'x=...; Y=...' sentence below:

"it doesn't" and "the problem is <line of code>" is not really detailed description of the error. Please post the exact error message!
I'd suggest to use an extra line for each statement, because the error message can tell you, which of the two statements causes the problems.

Kind regards, Jan

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
cell array Guangping Zhang 10 Mar, 2010 10:24:05
for loop Guangping Zhang 10 Mar, 2010 10:24:05
rssFeed for this Thread

Contact us at files@mathworks.com