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:
Insert different values in a vector

Subject: Insert different values in a vector

From: Sylvie

Date: 24 Feb, 2009 04:30:20

Message: 1 of 3

Hi there,

I have 4 vectors with 72 values each. I would like to insert the 3 last vectors into the 1st one:

 A=[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
B=[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51]
C=[1.5, 6.6, 11.8, 16.4, 21.9, 26.6, 31.8, 36.9, 41.7, 46.4, 51.9]
D=[2.5, 7.6, 12.8, 17.4, 22.9, 27.6, 32.8, 37.9, 42.7, 47.4, 52.9]

I want to create the vector A=[0, 1, 1.5, 2.5, 5, 6, 6.6, 7.6, 10, 11, 11.8, 12.8, (...), 52.9]

Any ideas?

Thank you!!

Sylvie

Subject: Insert different values in a vector

From: Husam Aldahiyat

Date: 24 Feb, 2009 05:02:17

Message: 2 of 3

"Sylvie " <sylpel@yorku.ca> wrote in message <gnvt4s$gbs$1@fred.mathworks.com>...
> Hi there,
>
> I have 4 vectors with 72 values each. I would like to insert the 3 last vectors into the 1st one:
>
> A=[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
> B=[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51]
> C=[1.5, 6.6, 11.8, 16.4, 21.9, 26.6, 31.8, 36.9, 41.7, 46.4, 51.9]
> D=[2.5, 7.6, 12.8, 17.4, 22.9, 27.6, 32.8, 37.9, 42.7, 47.4, 52.9]
>
> I want to create the vector A=[0, 1, 1.5, 2.5, 5, 6, 6.6, 7.6, 10, 11, 11.8, 12.8, (...), 52.9]
>
> Any ideas?
>
> Thank you!!
>
> Sylvie

A=sort([A B C D]);

Subject: Insert different values in a vector

From: Roger Stafford

Date: 24 Feb, 2009 06:28:02

Message: 3 of 3

"Sylvie " <sylpel@yorku.ca> wrote in message <gnvt4s$gbs$1@fred.mathworks.com>...
> Hi there,
>
> I have 4 vectors with 72 values each. I would like to insert the 3 last vectors into the 1st one:
>
> A=[0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
> B=[1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51]
> C=[1.5, 6.6, 11.8, 16.4, 21.9, 26.6, 31.8, 36.9, 41.7, 46.4, 51.9]
> D=[2.5, 7.6, 12.8, 17.4, 22.9, 27.6, 32.8, 37.9, 42.7, 47.4, 52.9]
>
> I want to create the vector A=[0, 1, 1.5, 2.5, 5, 6, 6.6, 7.6, 10, 11, 11.8, 12.8, (...), 52.9]
>
> Any ideas?
>
> Thank you!!
>
> Sylvie

 M = reshape([A;B;C;D],1,[]);

Roger Stafford

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