replacing entries in matrices

조회 수: 8 (최근 30일)
cgo
cgo 2015년 11월 10일
편집: Thorsten 2015년 11월 10일
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

채택된 답변

Thorsten
Thorsten 2015년 11월 10일
편집: Thorsten 2015년 11월 10일
R(10,:) = [10, 10];
R(50,:) = [20, 20];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by