MATLAB Answers

How to replace the 5 in my vector with decreasing numbers like 5,4,3,2,1

2 views (last 30 days)
x(3:4,3:5) = 5


Image Analyst
Image Analyst on 24 Feb 2020
The 5 what?
  1. The 5 values in the matrix that equal 5?
  2. Five elements in your matrix?
It's ambiguous because it's not clearly worded. How can you replace one number -- "the 5" -- with a set of 5 numbers? Are there exactly 5 elements in your matrix that have the value 5? What is the order that you replace them with: column major, or row major?
You are specifying a submatrix of 6 indexes. You didn't tell us how big x is or what its values are. Is this homework?
Pallav Patel
Pallav Patel on 24 Feb 2020
Try the command in Matlab and you will see the columns and rows specified will be filled with 5's. Matlab automatically fills an undefined vector with zeros. what I am trying to do is have a decreasing or increasing number and that was just a template to upload to Mathworks. I have seen such an example before but can't seem to find it.

Sign in to comment.

Accepted Answer

More Answers (1)

madhan ravi
madhan ravi on 23 Feb 2020

  1 Comment

Sign in to comment.

Sign in to answer this question.





Translated by