i have a matrix a=rand(1,10). now i want to change 2,4,6 position of matrix to 1.
how can i do that....
plz plz plz help me

 채택된 답변

Matt J
Matt J 2014년 6월 30일

1 개 추천

a([2,4,6])=1

댓글 수: 1

suchismita
suchismita 2014년 6월 30일
thank u....if the positions are random then what will be the code????

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

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2014년 6월 30일

1 개 추천

a = rand(10,1);
a(randperm(10,3)) = 1;

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

질문:

2014년 6월 30일

댓글:

2014년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by