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:
Colon Operator

Subject: Colon Operator

From: Anh

Date: 24 Sep, 2013 19:35:07

Message: 1 of 3

Hi guys :( I'm new in mathlab and don't know how to do this
( Use the colon operator, construct the matrix H whose first row is the second row of matrix A, and second and third rows are the second and third columns of matrix C, and the fourth row is the first row of matrix A in exercise 1. )
I tried H= [a(2,:) c(2,:) c(3,:) a(1,:)]
But all are wrong. anyone have suggestion ?
 Thanks

Subject: Colon Operator

From: TideMan

Date: 24 Sep, 2013 19:42:04

Message: 2 of 3

On Wednesday, September 25, 2013 7:35:07 AM UTC+12, Anh wrote:
> Hi guys :( I'm new in mathlab and don't know how to do this
>
> ( Use the colon operator, construct the matrix H whose first row is the second row of matrix A, and second and third rows are the second and third columns of matrix C, and the fourth row is the first row of matrix A in exercise 1. )
>
> I tried H= [a(2,:) c(2,:) c(3,:) a(1,:)]
>
> But all are wrong. anyone have suggestion ?
>
> Thanks

First of all, it's Matlab not mathlab.
Second, we don't do people's homework.
Third, the case of a variable is important. A is not the same as a.

Subject: Colon Operator

From: someone

Date: 24 Sep, 2013 20:35:07

Message: 3 of 3

TideMan <mulgor@gmail.com> wrote in message <f7d4ea20-b76a-4b06-becb-148ea499f017@googlegroups.com>...
> On Wednesday, September 25, 2013 7:35:07 AM UTC+12, Anh wrote:
> > Hi guys :( I'm new in mathlab and don't know how to do this
> >
> > ( Use the colon operator, construct the matrix H whose first row is the second row of matrix A, and second and third rows are the second and third columns of matrix C, and the fourth row is the first row of matrix A in exercise 1. )
> >
> > I tried H= [a(2,:) c(2,:) c(3,:) a(1,:)]
> >
> > But all are wrong. anyone have suggestion ?
> >
> > Thanks
>
> First of all, it's Matlab not mathlab.
> Second, we don't do people's homework.

I think you are being a little too hard on the OP.
It's true we don't simply DO people's homework,
BUT he showed what tried (which I think is very close)
and just asked for suggestions. I don't mind HELPING
someone who first makes an effort (as I think he did).

> Third, the case of a variable is important. A is not the same as a.

% With all the above in mind, try changing:
H= [a(2,:) c(2,:) c(3,:) a(1,:)]
% to
H= [A(2,:);C(2,:);C(3,:);A(1,:)] % note the semicolons

% Now, knowing that MATLAB matrix notation is (row,column)
% what do you think you have to do to C above to get
columns instead of rows into H? Is the number of columns the
same as the number of rows in A & C? If not, what will happen?

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