MATLAB Answers

Operations depending on the row/column

4 views (last 30 days)
Sean Spencer
Sean Spencer on 30 Jun 2020
Edited: madhan ravi on 30 Jun 2020
I have a 339x339 matrix (f2) containing values and I need to multiply all the cells below row 170 and columns less than 170 by -1. Below is what I have so far.
for t=1:339
if t < 170
f2=f2*-1;
end
end
This just makes everything negative.
Thank you for your help!

  0 Comments

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 30 Jun 2020
Edited: madhan ravi on 30 Jun 2020
f2(1:169,:) = -f2(1:169,:)

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!