How to insert data into matrix form?

For example I have data in row matrix from a for loop for each element,
for i=l:3
k11(i)
k12(i)
k21(i)
k22(i)
end
I cant seem to transfer this data to 3 2x2 matrix with the relevant data. I am coding
x=1:3
k(x)=[k11(x) k12(x) etc in matrix form.
Error says
In an assignment A(I) = B, the number of elements in B and I must be the same.
Any help? Thanks

 채택된 답변

Cedric
Cedric 2013년 2월 18일

0 개 추천

Is it something like
x = [k11, k12; k21, k22] ;
that you want to do? If knn were row vectors and you wanted to build a matrix x at some step ii of a loop, this would become
x = [k11(ii), k12(ii); k21(ii), k22(ii)] ;

댓글 수: 1

Walter Roberson
Walter Roberson 2013년 2월 18일
The poster wants variables named "k1", "k2", "k3" as the result of the loop, with the i'th "k" produced for loop value "i".

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2013년 2월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by