Reshape matrix to have the same value every 30 cells
이전 댓글 표시
Hi All,
I have a question: I have a matrix
A=[10; 20; 30; 40; 50; 50; 60]
How can I reshape it in order to have a matrix (7x30) X 1 such that the first 30 values are A(1), the next 30 have value of A(2), and so on...
thanks
nikolas
채택된 답변
추가 답변 (1개)
B=mat2cell(repmat(A,1,30),ones(1,7),30)
type A{1} and the result will be 30 10's.
댓글 수: 2
Nikolas Spiliopoulos
2018년 2월 19일
Guillaume
2018년 2월 19일
You're on a version earlier than R2016b. You have to use bsxfun on earlier versions.
Not that it matters, since the answer has completely changed.
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!