Filter löschen
Filter löschen

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 Ansichten (letzte 30 Tage)
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)?

Akzeptierte Antwort

KSSV
KSSV am 14 Jun. 2018
Bearbeitet: KSSV am 14 Jun. 2018
A = zeros(4) ;
A(1,2) = 1 ;
A(3,4) = 1 ;
Read about matlab matrix indexing.
  4 Kommentare
KSSV
KSSV am 14 Jun. 2018
I guess, you are working on FEM and you want to apply some boundary conditions at XY to given matrix A. is it?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by