Deleting rows in a cell array based on a specific value in a column
古いコメントを表示
Hi, I'm very new to Matlab and struggle with the following code. Any advice would be appreciated.
I have an cell array 7 x 2 cells. I would like to delete any rows when Column 2 contains 0.
A =
7×2 cell array
{[ 0]} {[0]}
{[ 1]} {[0]}
{[ 2]} {[0]}
{[ 3]} {[0]}
{[ 16]} {[1]}
{[ 17]} {[1]}
{[ 18]} {[1]}
Desirable outcome would be
A =
3×2 cell array
{[ 16]} {[1]}
{[ 17]} {[1]}
{[ 18]} {[1]}
I tried the following code but it gave me an error and I don't know how to resolve it. I know the issue is the probably the {} type but I don't know how to fix it.
A(A(:,2) == 0, :) = [];
Operator '==' is not supported for operands of type 'cell'.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!