Remove rows from a cell that contain a matrix

I am pulling values from a figure and it is a cell that has both numeric values and matrices. It is a 160 x 1 cell.
I want to remove the rows that contain a Matrix. For example my cell could look like the following:
1
2
1 x 4 matrix
3
4
after removal the cell should look like:
1
2
3
4
Any point in the right direction is greatly appreciated.
Thank you!

 Accepted Answer

Jan
Jan on 26 May 2021
Edited: Jan on 26 May 2021
YourCell = YourCell(cellfun('prodofsize', YourCell) == 1)
% or:
YourCell(cellfun('prodofsize', YourCell) > 1) = [];

2 Comments

This worked perfectly!! I really appreciate your help!
You are welcome.

Sign in to comment.

More Answers (0)

Categories

Products

Release

R2019a

Asked:

on 26 May 2021

Commented:

Jan
on 26 May 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!