Creating a matrix help

a=[111.23199; 354.44814; 186.69329]
b=[111.23199;111.23199;354.44814;354.44814;186.69329;186.69329]
How can I create a matrix "a" in the form of a matrix "b"?

Respuestas (2)

Star Strider
Star Strider el 26 de Mzo. de 2017

1 voto

This works:
aa = [a'; a'];
aa = aa(:)
aa =
111.23
111.23
354.45
354.45
186.69
186.69

5 comentarios

Muhendisleksi
Muhendisleksi el 26 de Mzo. de 2017
aa =
186.6933
186.6933
354.4481
354.4481
111.2320
111.2320
186.6933
186.6933
354.4481
354.4481
111.2320
111.2320
It happens like this
Jan
Jan el 26 de Mzo. de 2017
@Abdulbaki Atakan: Then you use another code. Try it again:
a = [111.23199; 354.44814; 186.69329]
aa = [a'; a'];
aa = aa(:)
This replies exactly what you have been asking for.
Star Strider
Star Strider el 26 de Mzo. de 2017
Another way, using the reshape function:
aa = reshape([a(:) a(:)]', [], 1)
aa =
111.23
111.23
354.45
354.45
186.69
186.69
Muhendisleksi
Muhendisleksi el 27 de Mzo. de 2017
Thank you so much
Star Strider
Star Strider el 27 de Mzo. de 2017
My pleasure.
If my Answer helped you solve your problem, please Accept it.

Iniciar sesión para comentar.

Jan
Jan el 26 de Mzo. de 2017

1 voto

With a modern Matlab version:
aa = repelem(a, 2, 1)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 26 de Mzo. de 2017

Comentada:

el 27 de Mzo. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by