How to save data of different size or type in a table on GUI?

1 view (last 30 days)
Hello! I'm working in a GUI where I want to have an Image and a Table where I can see properties of some image's object. With the Image I have no problem, my problem is the table. I have all the information about the object in a struct save in a file (.mat). I get this information searching the number of objects in the image and then, studying these. I can find 1,2,3 or more objects, according to the image. I have tried to use 'Table' selecting this from the figure (from the list on left), but I have to specify the number of rows, and columns (columns are 5 always, it isn't a problem). I need a variable number of rows , according to the number of objects. So, I decided use 'uitable'. The problem of the variable rows was solved, but now I have one more important, the type of data, and I can't solved that searching in help a lot of differents options. I need one of my columns accepts a different type, not another type but another size. I convert my struct to cell because I need it if I want to work with 'uitable', but my column number five is the object's position, so I have [x y], not only a number... I don't know if I have had explained very well, so I put part of my code, and to pictures where you could see the error what I have and what I want to put in my table (an example). Thanks you!
load todalainformacion
todaslasimagenes;
info=todaslasimagenes(1).imagen
filas=length(info);
columnas=5;
nombrescolumnas={'Area','Max','Min','Media','Cent'};
datos=struct2cell(info)
w=cell(filas,5);
for i=1:filas
columnadatos=datos(:,i);
filadatos=columnadatos';
w(i,:)=filadatos;
end
pos1=get(handles.uipanel1,'Position');
t=uitable('ColumnName',nombrescolumnas,'Data',w,'Units','characters','Position',pos1);
<<
>>

Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!