cell-array

How do I assign an empty matrix to elements of a cell array in MATLAB?

I want to manipulate a cell array and make certain indices of the cell array contain the empty matrix []. I can't seem to figure out how to do this: >> yy=num2cell(1:10) yy = [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] >> yy{1:2:end}=[] ??? The right hand side of this assignment has too few values to satisf...

MATLAB: image corner coordinates & referncing to cell arrays

I am having some problems comparing the elements in different cell arrays. The context of this problem is that I am using the bwboundaries function in MATLAB to trace the outline of an image. The image is of a structural cross section and I am trying to find if there is continuity throughout the section (i.e. there is only one outline ...

How can I accumulate cells of different lengths into a matrix in MATLAB?

So, I have a cell-array of 1xN vectors of different lengths. I want to append them into a matrix so I can display them with imagesc. Obviously the matrix must be the width of the largest vector. My current code for this is below: tcell = {[1,2,3], [1,2,3,4,5], [1,2,3,4,5,6], [1], []}; lens = cellfun('length', tcell); rmat = NaN(length(...

How can I access nested cell arrays in MATLAB?

I would like to make a nested cell array as follows: tag = {'slot1'} info = {' name' 'number' 'IDnum'} x = {tag , info} And I want to be able to call x(tag(1)) and have it display 'slot1'. Instead I am getting this error: ??? Error using ==> subsindex Function 'subsindex' is not defined for values of class 'cell'. If I call x(1) MA...

Creating nested cell arrays in Matlab?

I have two cell arrays one called info{} and the other is called data{} I am reading information in from a text file and am putting the lines into the info{} cell array. When the program finds a blank line I want to to start over with a new info{} cell array and keep inserting the lines until it find another blank line... global dat...

Strcmp for cell arrays of unequal length in MATLAB

Is there an easy way to find a smaller cell array of strings within a larger one? I've got two lists, one with unique elements, and one with repeating elements. I want to find whole occurrences of the specific pattern of the smaller array within the larger. I'm aware that strcmp will compare two cell arrays, but only if they're equal in ...

MATLAB: comparison of cell arrays of string

I have two cell arrays of strings, and I want to check if they contain the same strings (they do not have to be in the same order, nor do we know if they are of the same lengths). For example: a = {'2' '4' '1' '3'}; b = {'1' '2' '4' '3'}; or a = {'2' '4' '1' '3' '5'}; b = {'1' '2' '4' '3'}; First I thought of strcmp but it would r...

How to read multiple files into a single cell array?

Hi, I have a large dataset split into 5 files (each has 15000 attributes, first file contains header (attribute names) and 9999 records, and the other 4 contain 10000 records). Using textscan, I have created 5 cell arrays which have to be merged and don't know whether this approach is appropriate or it would be better to directly read ...

Finding and filtering elements in a MATLAB cell array

Hi, I have a list (cell array) of elements with structs like this: mystruct = struct('x', 'foo', 'y', 'bar', 's', struct('text', 'Pickabo')); mylist = {mystruct <more similar struct elements here>}; Now I would like to filter mylist for all structs from which s.text == 'Pickaboo' or some other predefines string. What is the best way ...