MATLAB Answers

leeee
0

how to multiply a number in even rows of matrix?

Asked by leeee
on 21 Oct 2019
Latest activity Answered by Akira Agata
on 21 Oct 2019
I have: output2=-1*ones(input1,input4), how do i make all the even columns be 2? Thanks
Task: output2 is an (input1) × input4 matrix where the entries of all the odd columns are all -1 and the entries of all the even columns are all 2’s.

  0 Comments

Sign in to comment.

Tags

Products


Release

R2019b

1 Answer

Answer by Akira Agata
on 21 Oct 2019
 Accepted Answer

Please try the following:
output2(:,2:2:end) = 2;

  0 Comments

Sign in to comment.