Effacer les filtres
Effacer les filtres

replacing entries in matrices

6 vues (au cours des 30 derniers jours)
cgo
cgo le 10 Nov 2015
Modifié(e) : Thorsten le 10 Nov 2015
I begin with a nx2 matrix (coordinate positions of n particles in a 2d plane), call this R. Initially, all the elements in R are zero.
R = zeros(n,2);
I have identified that after some conditions, the 10th and 50th particles will have to change their positions to (10,10) and (20,20).
So I want to put the coordinates (10,10) and (20,20) into the 10th and 50th row, respectively, while keeping all the others zero. How do I do that?
Thanks

Réponse acceptée

Thorsten
Thorsten le 10 Nov 2015
Modifié(e) : Thorsten le 10 Nov 2015
R(10,:) = [10, 10];
R(50,:) = [20, 20];

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by