How to Create/Modify for matrices or matrix

5 次查看(过去 30 天)
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?

采纳的回答

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

更多回答(1 个)

Les Beckham
Les Beckham 2022-4-12
编辑:Les Beckham 2022-4-12
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

类别

Help CenterFile Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by