필터 지우기
필터 지우기

converting vector to matrix

조회 수: 3 (최근 30일)
shivakumar
shivakumar 2013년 5월 23일
Am beginner to this please tell me is there any function to convert vector to matrix.
vec=[0:4.80314960629921e-6:.00061]
which gives values from column 1 to column 128. i want to convert it to a matrix of 8 rows 16 columns.

채택된 답변

James Tursa
James Tursa 2013년 5월 23일
reshape(vec,16,8)'

추가 답변 (2개)

David Sanchez
David Sanchez 2013년 5월 23일
vec=[0:4.80314960629921e-6:.00061];
my_matrix=zeros(8,16);
for k=1:8
my_matrix(k,:) = vec(k*16-15:k*16);
end

Brwa
Brwa 2013년 5월 23일
Both of David Sanchez and james tursa have done it well, but in the case of james tursa he miss type i think he should type as
reshape(vec,8,16)
  댓글 수: 1
shivakumar
shivakumar 2013년 5월 23일
yeah you are right it produces 16 rows & 8 col.... tnx a lot

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by