フィルターのクリア

Varying the name of variable within a for loop

2 ビュー (過去 30 日間)
Will
Will 2012 年 2 月 8 日
Hi
Is there a way to change the name of a matrix within a 'for' loop? For example, i might have an initial vector:
x0=[1 1]
and within the loop, I would like to change the name of the matrix to x1. Writing x(i) obviously just populates that position with the matrix.
Thanks

採用された回答

Image Analyst
Image Analyst 2012 年 2 月 8 日
  2 件のコメント
Will
Will 2012 年 2 月 8 日
Fair enough-that makes sense but......if I store my x(i) within x and x is (i x 2) matrix, how can I call/use the numbers on the i row. i.e. if I want to use x(5), I want x(5) to be a 1x2.
Walter Roberson
Walter Roberson 2012 年 2 月 8 日
You cannot. However, you can have x{5} be 1x2
for K = 1 : 10
x{K} = rand(1,2);
end
then
x{1}
x{2}
and so on.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by