dynamic name for matrices

3 次查看(过去 30 天)
Elia
Elia 2014-1-22
评论: Amit 2014-1-22
i want to create a dynamic name for the matrices , that are generated through a loop .
for j=1:x
for i=1:y
.
.
%a matrix with the name T is generated for every time the loop runs
T(i)=...
end
A(j)=T(:)
end
A(j) didn't work in the parent loop

回答(2 个)

dpb
dpb 2014-1-22

Amit
Amit 2014-1-22
A = zeros(x,y);
for j=1:x
for i=1:y
.
.
%a matrix with the name T is generated for every time the loop runs
T(i)=...
end
A(j,:)=T(:)
end
  1 个评论
Amit
Amit 2014-1-22
you dont need to create a dynamic matrix for T. Simple indexing would work.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by