Delete columns of matrices in a cell array
3 ビュー (過去 30 日間)
古いコメントを表示
I have a 1x5 cell array ,A, and each cell contains a 3x3 matrix. I'm trying to delete the second column from the matrix in each cell without using a for loop. I thought the following code might work but it does not. Any one has a good solution? Thanks.
Code I tried:
cellfun(@(x)x(:,2)= [],A)
Error message: The expression to the left of the equals sign is not a valid target for an assignment.
0 件のコメント
採用された回答
Wayne King
2013 年 2 月 21 日
編集済み: Wayne King
2013 年 2 月 21 日
B = cellfun(@(x) x(:,[1 3]),A,'uni',0);
or
C = cellfun(@(x) x(:,1:2:end),A,'uni',0);
その他の回答 (1 件)
Azzi Abdelmalek
2013 年 2 月 21 日
A={rand(3) rand(3) rand(3)}
cellfun(@(x) x(:,[1 3]),A,'un',0)
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!