using matlab in term if creating a function to break a 16x1vector into a 4x4 matrix

조회 수: 2 (최근 30일)
I need to write a function in matlab that will Convert a [16×1] into a [4×4] form.
eg. [d1,d2,...,d16]into[d1 d5 d9 d13; d2 d6 d10 d14; d3 d7 d11 d15; d4 d8 d12 d16]
Can anyone give me a clue to make a function that will be able to convert these numbers?

답변 (1개)

Image Analyst
Image Analyst 2013년 9월 7일
I answered that same question just a few days ago : http://www.mathworks.com/matlabcentral/answers/86438#answer_95906
  댓글 수: 2
Samious
Samious 2013년 9월 7일
Thank for the link image but can I ask you a question. Why is ctr=1? And why do we need ctr=ctr+1 or X (ctr)
Image Analyst
Image Analyst 2013년 9월 7일
That's Youssef's answer. It's standard programming for most languages, but not very MATLAB-ish. ctr is a counter and it's used to increment the linear array. The linear index increments differently than the row and column indexes of the output 4x4 array so he used that to increment the linear array X.

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

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by