# how to replace 1 element in matrix

2 views (last 30 days)
Brendan Steele on 27 Jan 2022
Commented: VBBV on 27 Jan 2022
I have matrix A and its a 4 by 5 I want to replace the element (3,4) and create a new matrix for it and name it B what would I do? D = A(3,4)=75 is what I have input but theres an error with to may = signs
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (2)

KSSV on 27 Jan 2022
Edited: KSSV on 27 Jan 2022
D = A(3,4) % thats it
Please don't ask very simple and basic questions in the community. Take a tutorial on basics of MATLAB.
##### 2 CommentsShowHide 1 older comment
KSSV on 27 Jan 2022
You can take a bsic turotials on this link:

Sign in to comment.

VBBV on 27 Jan 2022
A = rand(4,5);
A(3,4) = 75;
D = A;
You can assign the new matrix to old one after replacing the value with 75. Read more info as @KSSV suggested
##### 1 CommentShowHide None
VBBV on 27 Jan 2022
A = rand(4,5)
D = double(subs(A,A(3,4),75))
You can also try with subs

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!