How to use for loop and ifelse condition with Nx1 matrix.
1 view (last 30 days)
Show older comments
Hyowon Lee
on 17 Nov 2015
Answered: Walter Roberson
on 17 Nov 2015
A:N x 1 matrix.
n = size(A,1)
for i = 1:n % increment 1
if A(i,1) = 5 % Error: The expression is to the left....
A(i,1) = 1 % when A(i,1) = 5 , replace A(i,1) original value to 1.
Error message.
Error: The expression to the left of the equals sign is not a valid target for an assignment.
Do you know how to replace original values in a matrix to a specific value on the basis of comparision between matrix value and a value such as 5?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!