How can i manipulate a matrix with this characteristics?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, i have a matrix wtih repeated elements like:
[1 4 1 4 2 3 3 5 5 6 6 5]
i want break that matrix. And then in each other matrix, running in a cycle, have only the index referent to each number (1, 2, 3, ...), something like:
1 2 3 4 5 6
[1 4] [2 3] [2 3 [1 4] [3 5 [5 6
3 5] 5 6 6 5]
6 5]
I tried creating a 3 dimension matrix (i,j,k) and each 3rd dimension having above matrix. That hypothesis gives me the repeated solutions inside. I tried to get them out but I might not be able to.
I hope someone can help me out.
PS: Some question that may have, just do it pls.
Regards, Vitor Ribeiro.
0 件のコメント
採用された回答
Joseph Cheng
2014 年 4 月 9 日
編集済み: Joseph Cheng
2014 年 4 月 9 日
You can use cells for this. I do not see the pattern you have for [1 4 1 4 2 3 3 5 5 6 6 5] to the broken up matrix. but to set the broken up matrix with index references, cells should work.
MATRIX{1} = [1 4];
MATRIX{2} = [2 3];
MATRIX{3} = [2 3;3 5];
etc.
Which should be simple enough to accomplish in a for loop with whatever initial matrix breakup pattern is.
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!