How to Update matrix values

I have a matrix[2 2:2 2]I want to update these four values one by one ie[3 3:3 3],[4 4:4 4],[5 5:5 5] like thgis I want to update ,,,how can i achieve this with script?

 採用された回答

Sriram
Sriram 2013 年 1 月 2 日

0 投票

b = {};
a=[1 2;3 4]
for i=1:1:100;
a=a+1;
b = [b a];
end

1 件のコメント

Arun Badigannavar
Arun Badigannavar 2013 年 1 月 2 日
exactly what i wanted

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 1 月 2 日

0 投票

A = A + 1;

4 件のコメント

Arun Badigannavar
Arun Badigannavar 2013 年 1 月 2 日
a=[1 2;3 4]
for i=1:100;
a(i)=a(i)+1;
end
How to see the each update value
Arun Badigannavar
Arun Badigannavar 2013 年 1 月 2 日
a=[1 2;3 4]
for i=1:1:100;
a=a+1
end
Here I want to see the a values for each step of i,,,which is saved in the array of a(i)
Walter Roberson
Walter Roberson 2013 年 1 月 2 日
If you want to see each updated value, you could remove the semi-colon from the addition
a(i) = a(i) + 1 %no semi-colon
Arun Badigannavar
Arun Badigannavar 2013 年 1 月 2 日
ya i know this ,,but i want to save the value of a(i) from i =1 to i=100

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by