Turn one matrix into many matrices
이전 댓글 표시
Say I have an Nx2 Matrix, called 'A' -- how would I turn this into N vectors called 'A1', 'A2'...'AN'?
My current solution is to open Excel, add row headers, and then import the data. Looking for a more automated way to do this in MATLAB.
More details:
I have two matrices, one is Nx2, the other is MxP.
For each row in matrix 1, I need to extract rows out of matrix 2 and append four columns of additional data to them. Sometimes a particular row could be extracted from the second matrix multiple times. In that case, the appended data would be different each time.
At the end of the day, I need N matrices of size Qx(P+4). I would prefer this to having one 3D matrix of size NxQx(P+4), as the number of rows that I extract from the second matrix will not be the same each time.
Since I would prefer to have N matrices as the output, I thought it would be best to just start with N vectors as the input.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!