How to Create/Modify for matrices or matrix

조회 수: 35 (최근 30일)
Mirza Etnisa
Mirza Etnisa 2022년 4월 12일
편집: Les Beckham 2022년 4월 12일
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에서 Embedded Coder Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by