필터 지우기
필터 지우기

How do I select elements out of a matrix with a loop?

조회 수: 2 (최근 30일)
Gerdur Gardarsdottir
Gerdur Gardarsdottir 2013년 9월 25일
Hi, please help. I have a 16x16 matrix where I need to pick a 16 elements out for a 4x4 matrix. (Guyan reduction) I don't know how to make loops jet. /Klara

답변 (1개)

David Sanchez
David Sanchez 2013년 9월 25일
You can try the following:
A = rand(16); % a 16x16 random matrix
B = reshape(M,4,4,16); % you will get 16 4x4 matrices. To access these matrices:
for k=1:16
B(:,:,k);
end
  댓글 수: 2
Gerdur Gardarsdottir
Gerdur Gardarsdottir 2013년 9월 25일
Thank you very much for your answear. But I have 16 dof (16x16)matrix and I need to be able to retain some dof´s e.g. (3 7 11 15) and out them into a 4x4 matrix and then have the omitted in a 12x12 and retian,omitted in an 4x12. I just don-t know how to "pick out" the retained after I have defined them :(.
Jan
Jan 2013년 9월 25일
편집: Jan 2013년 9월 25일
@Gerdur: I do not understand your question. While many readers are not familiar with the "Guyan reduction", you are. So please explain it as clear as possible. What does this mean: "have the omitted in a 12x12 and retian,omitted in an 4x12"?

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

카테고리

Help CenterFile Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by