Change column in array

8 Ansichten (letzte 30 Tage)
nty huy
nty huy am 27 Sep. 2019
Bearbeitet: KALYAN ACHARJYA am 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?

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 27 Sep. 2019
Bearbeitet: KALYAN ACHARJYA am 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

Kategorien

Mehr zu Data Types finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by