Changing a specific value in a matrix

Quick question :)
Have searched all over for a solution to this problem.
I would like to change a value in a matrix, it could as little as a 3x5 matrix for instance.
I request a x,y input where i would want a function to change the value (it could be from 0 to 1 or 9) in the matrix (2,4 for instance). I have found plenty of solutions where you change all the 0's to 1's but not a specific target.
Thanks in advance

 채택된 답변

Mahdi
Mahdi 2013년 4월 26일

1 개 추천

Let your data be in matrix A, and x,y are the indices where you want to change the value
A(x,y)=2 %2 is just a random number I chose.

댓글 수: 1

Mirko
Mirko 2013년 4월 26일
Oh god that was easy! Thanks alot for the help :)
*Rest his head in shame!!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2013년 4월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by