필터 지우기
필터 지우기

how can i obtain this ?

조회 수: 1 (최근 30일)
diadalina
diadalina 2017년 11월 21일
댓글: diadalina 2017년 11월 21일
i would like to use the command reshape to convert a vector v=11:99 to a matrix (9x9), how can i do this, can anyone help me ?

채택된 답변

Birdman
Birdman 2017년 11월 21일
You can not do it when v=11:99.
If you want to convert to 9x9 matrix, then you need to have 81 elements in your vector, with this you have 89. If you define it as v=11:91, then the following command will do what you want.
v=reshape(v,9,9)
  댓글 수: 13
Birdman
Birdman 2017년 11월 21일
v=11:99;
IND=find(mod(v,10)==0);
v(IND)=[];
v=reshape(v,9,9)
diadalina
diadalina 2017년 11월 21일
that's exactly , what i want, thank you very much.

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

추가 답변 (1개)

KL
KL 2017년 11월 21일
Simpler with just one line,
bsxfun(@plus,1:9,(10:10:90).')
  댓글 수: 1
diadalina
diadalina 2017년 11월 21일
thank you Mr,Kl for your answer.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by