Please help

2 ビュー (過去 30 日間)
Nikola
Nikola 2012 年 1 月 23 日
Dear Sirs,
I have question.
For example I have 2x2 array A = [1,10;20,30].
Now I want to make array of arrays changing the first position.
How to write function if I want to get this array:
[1,10;20,30]
[2,10;20,30]
[3,10;20,30]
[4,10;20,30]
[5,10;20,30]
So the point is I want to change just A(1,1) (1,2,3,4,5).
Thank you very much in advanced.
  1 件のコメント
the cyclist
the cyclist 2012 年 1 月 23 日
It's not clear to me what you want the size of the final "array of arrays" to be. 2x2x5? 10x2? Or do you want to generate 5 different 2x2 arrays, perhaps stored in a cell array?

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

採用された回答

Jan
Jan 2012 年 1 月 23 日
A = [1,10; 20,30];
for i = 0:4
B = A + [i,0; 0,0];
disp(B);
end
or
A = [1,10; 20,30];
a11 = A(1, 1);
for i = 0:4
A(1) = a11 + i;
disp(A);
end

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by