Changing a specific value in a matrix

244 views (last 30 days)
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

Accepted Answer

Mahdi
Mahdi on 26 Apr 2013
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 Comment
Mirko
Mirko on 26 Apr 2013
Oh god that was easy! Thanks alot for the help :)
*Rest his head in shame!!

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!