How to Create/Modify for matrices or matrix

16 vues (au cours des 30 derniers jours)
Mirza Etnisa
Mirza Etnisa le 12 Avr 2022
Modifié(e) : Les Beckham le 12 Avr 2022
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?

Réponse acceptée

Arif Hoq
Arif Hoq le 12 Avr 2022
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

Plus de réponses (1)

Les Beckham
Les Beckham le 12 Avr 2022
Modifié(e) : Les Beckham le 12 Avr 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

Catégories

En savoir plus sur Simulation, Tuning, and Visualization dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by