Insert an index in a for loop

1 view (last 30 days)
Cristiana Abilheira
Cristiana Abilheira on 1 Apr 2019
Edited: KSSV on 1 Apr 2019
Hi,
I need to create a for loop like
for i=1:size(A,1)
Matrix(index)(:,i)= expression
end
I want to get a list of matrix like
Matrix1,Matrix2,Matrix3,Matrix4...
is that possible?

Accepted Answer

KSSV
KSSV on 1 Apr 2019
Edited: KSSV on 1 Apr 2019
A = zeros(2,2,10) ;
for i = 1:10
A(:,:,i) = rand(2) ;
end
A(:,:,1)
A(:,:,3)
In your case follow:
for i=1:size(A,1)
Matrix(:,:,i)= expression ;
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!