MATLAB Answers

Change column in array

6 views (last 30 days)
nty huy
nty huy on 27 Sep 2019
Edited: KALYAN ACHARJYA on 27 Sep 2019
Arr= [ 5 5 5 5 ; 5 5 5 5; 5 5 5 5 ; 5 5 5 5; 5 5 5 5]
how to change all elements in a column to a diffrent number?

  0 Comments

Sign in to comment.

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 27 Sep 2019
Edited: KALYAN ACHARJYA on 27 Sep 2019
Arr=[5 5 5 5 ; 5 5 5 5; 5 5 5 5 ; 5 5 5 5; 5 5 5 5];
% First column number change the 10
Arr(:,1)=10
%Do the same for others
Result:
Arr =
10 5 5 5
10 5 5 5
10 5 5 5
10 5 5 5
10 5 5 5
You can do multiple column elements change with single assignments also

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags