필터 지우기
필터 지우기

How do I take a matrix of x,y values and insert in a value 1 in a square matrix? For instance in a Mat = 4 x 4 matrix of zeros and the matrix XY = (1,2) (3,4). How do I enter a 1 into (1,2) and (3,4)?

조회 수: 2 (최근 30일)
How do I take a matrix of x,y values and insert in a value 1 in a square matrix? For instance in a Mat = 4 x 4 matrix of zeros and the matrix XY = (1,2) (3,4). How do I enter a 1 into the positions (1,2) and (3,4)?

채택된 답변

KSSV
KSSV 2018년 6월 14일
편집: KSSV 2018년 6월 14일
A = zeros(4) ;
A(1,2) = 1 ;
A(3,4) = 1 ;
Read about matlab matrix indexing.
  댓글 수: 4
KSSV
KSSV 2018년 6월 14일
I guess, you are working on FEM and you want to apply some boundary conditions at XY to given matrix A. is it?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by