Function to extract certain elements from a matrix
2 ビュー (過去 30 日間)
古いコメントを表示
I have difficulties in making a function to extract columns after first number in the row from a the matrix. For example I have this matrix (A) and I want all columns that have first element 1 to be extracted in another matrix
A= 1 2 1 1 3
2 5 6 4 8
2 3 5 7 8
And I want my function to return this:
B= 1 1 1
2 6 4
2 5 7
0 件のコメント
採用された回答
Mischa Kim
2014 年 4 月 10 日
Ciuban, use
B = A(:,A(1,:)==1)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multidimensional Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!