필터 지우기
필터 지우기

Expand matrix pattern by rows only

조회 수: 1 (최근 30일)
Mathias Andersen
Mathias Andersen 2020년 4월 30일
댓글: Adam Danz 2020년 4월 30일
I want to expand the following pattern 365 times. Have tried the repmat command, however this will produce 365 columns as well which is too big for matlab to handle.
So the end result i want is a matrix of size 86400*365,1
A = 0:28800;
B = 28801:43200;
C = 43201:46800;
D = 46801:61200;
E = 61201:86400;
x = [zeros(28800,1); 400*ones(length(B),1); zeros(length(C),1); 400*ones(length(D),1); zeros(length(E),1)];
  댓글 수: 1
Adam Danz
Adam Danz 2020년 4월 30일
I suggest using numel() instead of length(). The length function should be avoided because its results can be misleading when working with matrices that have more than 1 row or column.

댓글을 달려면 로그인하십시오.

채택된 답변

Tommy
Tommy 2020년 4월 30일
You can give multiple dimensions to repmat:
repmat(x,1,365)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by