Search code examples
matlabuitableviewmatlab-guidecell-arrayclickable

Create and display clickable cell of cells in Matlab GUI


I want to display a cell matrix in Matlab GUI. Moreover, some of that cells are arrays of cells, and I want them to be clickable and that by clicking on them I activate a function.

Imagine I have a cell matrix:

A=cell(2,2); 
A{1,1}='Column1';
A{1,2}='Column2';
A{2,1}={'A','B','C','D'};
A{2,2}={'E','F'};

I want to display it on an GUI, and I want to be able to click the cells, say to see the content of A{2,1}. Then I would like to click the cell entries in this cell array, and by doing so, I calculate a new matrix of the same form to display on the GUI. However, uitable doesn't allow me to use a cell array.

An alternative would be to have a matrix of the form:

A=cell(5,2);
A{:,1}={'Column1','A',B',C',D'};
A{:,2}={'Numbers',1,2,3,4};

And by clicking the numbers (which I can do) a buttongroup would display (of undefined size), and by selecting one it would calculate a new matrix of the same form to display.

Thanks in advance.


Solution

  • Short answer: you can't

    MATLAB GUI only provides only a very parse set of possible gui-elements check this documentation of MATLAB GUI. You need to change your request, so e.g. create an uitable or something like this. If you desire to create more advanced stuff in MATLAB GUI's, then you should start to look into this fellas documentation