Fill in a data vector into a preallocated zeros matrix

조회 수: 3 (최근 30일)
Sebastian Engelsgaard
Sebastian Engelsgaard 2021년 1월 22일
답변: James Tursa 2021년 1월 22일
Hi,
I have a vector (called v) of size
[2000004×1 double]
with data, and I want to split this into a preallocated 500001x4 matrix (called m). The data needs to be extracted cronologically meaning that v(1,1) = m(1,1) and v(500002,1)=m(1,2)
Can anyone help?

채택된 답변

James Tursa
James Tursa 2021년 1월 22일
m = reshape(v,500001,4);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by