How to Create/Modify for matrices or matrix

K=5
matA= [1 2 ..4 K]
matB=[matA matA matA matA matA]
matB=[1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5]
How to operate this equation matB?

 Respuesta aceptada

try this:
K=5
K = 5
matA=1:K;
% matB=[matA matA matA matA matA]
% matB=[1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5]
matB=repmat(matA,size(matA,1),numel(matA))
matB = 1×25
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

Más respuestas (1)

Les Beckham
Les Beckham el 12 de Abr. de 2022
Editada: Les Beckham el 12 de Abr. de 2022
K=5;
matA = 1:K
matA = 1×5
1 2 3 4 5
matB = repmat(matA, 1, K)
matB = 1×25
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

Categorías

Más información sobre Simulation, Tuning, and Visualization en Centro de ayuda y File Exchange.

Productos

Versión

R2019a

Preguntada:

el 12 de Abr. de 2022

Editada:

el 12 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by