Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Skip lines in an array -sorry

Subject: Skip lines in an array -sorry

From: Maxx Chatsko

Date: 12 Jul, 2010 19:21:05

Message: 1 of 2

So I guess my real question isn't about for loops, but about passing in rows of data from an array of data into an array of zeros. If I have

       zero_array(min:max,:)=data_array(???)

 is there a way to skip every fourth row in five when passing the data into the new array?
               Maxx
I'll be more precise next time. Promise.

Subject: Skip lines in an array -sorry

From: James Tursa

Date: 13 Jul, 2010 00:09:04

Message: 2 of 2

"Maxx Chatsko" <chatskom@chemimage.com> wrote in message <i1fpv1$5ga$1@fred.mathworks.com>...
> So I guess my real question isn't about for loops, but about passing in rows of data from an array of data into an array of zeros. If I have
>
> zero_array(min:max,:)=data_array(???)
>
> is there a way to skip every fourth row in five when passing the data into the new array?
> Maxx
> I'll be more precise next time. Promise.

You can use logical indexing. e.g.,

[x y] = size(zero_array);
z = true(1,x);
z(4:5:end) = false;
zero_array(z,:) = data_array(etc.);

James Tursa

Tags for this Thread

No tags are associated with this thread.

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.

Contact us