How look for value inside Cell_array?
显示 更早的评论
I've a cell_array of data, the dimension is 'Cell_P' 10x1, inside every cell there is a matrix 25x16. I need six columns of the matrix, and I can find these because I know the values of parameters inside. I need to make a new cell_array with inside 10 matrix 25x6.
I would like insert as input six values, identify the columns where the values are, create a new cell_array with just that column.
How can I do it?
2 个评论
Triveni
2016-2-22
try
Cell_P{:}
Matthew
2016-2-22
An example of inputs and desired outputs would be helpful.
That said, I would guess that something like this is what you're going for, tweaked as appropriate for your exact data types and structures.
%If your inputs are numerical
cellIndex = cellfun(@(x) ismember(x,myInputValues),inputCellArray(1,:));
outputArray = inputCellArray(:,cellIndex);
%if your inputs are strings
cellIndex = ismember(inputCellArray(1,:),myInputValues);
outputArray = inputCellArray(:,cellIndex);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!