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:
Help with splitting matrix into groups and finding size

Subject: Help with splitting matrix into groups and finding size

From: Alex

Date: 24 Apr, 2009 10:02:59

Message: 1 of 3

I have a matrix F and I want to find the number of values of F between 0 and 0.1, 0.1 and 0.2 and so on, I have written the following m-file

r = 1:k;
b = 0:(1/k):1;
f = length((F >= b(r)) && (F <= b(r+1)))

I seem to be getting an error that matrix dimensions dont agree, any ideas?

Subject: Help with splitting matrix into groups and finding size

From: Matt

Date: 24 Apr, 2009 12:58:01

Message: 2 of 3

"Alex" <a.shan@hotmail.co.uk> wrote in message <gss2oj$eob$1@fred.mathworks.com>...
> I have a matrix F and I want to find the number of values of F between 0 and 0.1, 0.1 and 0.2 and so on, I have written the following m-file
>
> r = 1:k;
> b = 0:(1/k):1;
> f = length((F >= b(r)) && (F <= b(r+1)))
>
> I seem to be getting an error that matrix dimensions dont agree, any ideas?

Not from what you've given above, but regardless, you're reinventing the wheel. You should be using histc()

Subject: Help with splitting matrix into groups and finding size

From: Matt

Date: 24 Apr, 2009 13:07:01

Message: 3 of 3

"Matt " <xys@whatever.com> wrote in message <gssd0p$q76$1@fred.mathworks.com>...
> "Alex" <a.shan@hotmail.co.uk> wrote in message <gss2oj$eob$1@fred.mathworks.com>...
> > I have a matrix F and I want to find the number of values of F between 0 and 0.1, 0.1 and 0.2 and so on, I have written the following m-file
> >
> > r = 1:k;
> > b = 0:(1/k):1;
> > f = length((F >= b(r)) && (F <= b(r+1)))
> >
> > I seem to be getting an error that matrix dimensions dont agree, any ideas?

One problem might be that you're using && instead of &

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