Change column in array

41 ビュー (過去 30 日間)
nty huy
nty huy 2019 年 9 月 27 日
編集済み: KALYAN ACHARJYA 2019 年 9 月 27 日
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?

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 9 月 27 日
編集済み: KALYAN ACHARJYA 2019 年 9 月 27 日
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

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by