필터 지우기
필터 지우기

How can I convert 1d vector into 4d matrix?

조회 수: 12 (최근 30일)
Chang seok Ma
Chang seok Ma 2021년 3월 11일
답변: Walter Roberson 2021년 3월 11일
Hello,
I have a vector called VV which is 1d vector (38766 * 1)
And I want to convert this vector into the matrix V.
I wanted to do something like below.
Put first value of VV into V(1,1,1,1) and the second value of VV into V(1,1,1,2)
Third value into V(1,1,2,1) and forth into V(1,1,2,2) and so on...
But I am not sure how to implement this.
Any idea?
Thanks in advance.
for i = 1:91
for j = 1:71
for k = 1:3
for l = 1:2
V(i,j,k,l) = VV???
end
end
end
end

채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 11일
V = permute(reshape(VV, 2, 3, 71, 91),[4 3 2 1]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by