How to create separate tables so that I can have them open at the same time?
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have attached the related code and excel sheet below. The code I have now creates tables but once I run another table, the one I had previously open disappears until I run its code again. Any ideas of how I could get these tables to stay open in different tabs?
t = readtable('Alaska_1418.xlsx');
[G,group_ID] = findgroups(t{:,4});
% make a cell array of tables, one for each group:
n_groups = numel(group_ID);
new_t = cell(1,n_groups);
for ii = 1:n_groups
new_t{ii} = t(G == ii,:);
end
% look at the table for group 1:
mud1=new_t{1};
%%
clastpoor=new_t{2};
%%
diatomooze=new_t{3};
%%
mudstoneanddiatom=new_t{4};
%%
siltstoneandmudstone=new_t{5};
%%
mud2=new_t{6};
%%
sand=new_t{7};
0 comentarios
Respuestas (2)
Ganesh Gudipati
el 12 de Abr. de 2022
Hi,
As per my understanding, some tables are generated from the code and those tables should be displayed simultaneously in different tabs.
This can be done using the uitable and figure.
Add two lines for every table that should be displayed.
> fig = uifigure;
> uit = uitable(fig, “Data”, table_name);
Note: the variables fig and uit should be unique for every table.
Code:
t = readtable('Alaska_1418.xlsx');
[G,group_ID] = findgroups(t{:,4});
% make a cell array of tables, one for each group:
n_groups = numel(group_ID);
new_t = cell(1,n_groups);
for ii = 1:n_groups
new_t{ii} = t(G == ii,:);
end
% look at the table for group 1:
mud1 = new_t{1};
fig = uifigure;
uit = uitable(fig,'Data',mud1);
%%
clastpoor=new_t{2};
fig2 = uifigure;
uit2 = uitable(fig2,'Data',clastpoor);
%%
diatomooze=new_t{3};
fig3 = uifigure;
uit3 = uitable(fig3,'Data',diatomooze);
%%
mudstoneanddiatom=new_t{4};
fig4 = uifigure;
uit4 = uitable(fig4,'Data',mudstoneanddiatom);
%%
siltstoneandmudstone=new_t{5};
fig5 = uifigure;
uit5 = uitable(fig5,'Data',siltstoneandmudstone);
%%
mud=new_t{6};
fig6 = uifigure;
uit6 = uitable(fig6,'Data',mud);
%%
sand=new_t{7};
fig7 = uifigure;
uit7 = uitable(fig7,'Data',sand);
The other possible simplest work around is, once the code is executed go to the workspace and view tables by clicking table_names.
0 comentarios
VBBV
el 5 de Feb. de 2025 a las 23:34
@Jacob Allen You can make the following changes to the code. If you want to display table data in different tabs you can use uitabgroup, uitab components with uitable to display table data in the same figure window.
mud1 = new_t{1};
clastpoor=new_t{2};
diatomooze=new_t{3};
mudstoneanddiatom=new_t{4};
siltstoneandmudstone=new_t{5};
mud=new_t{6};
sand=new_t{7};
fig = uifigure;
tg = uitabgroup(fig,'Position',[20 20 450 400]) % use uitabgroup
uit1 = uitab(tg,"Title","Mud"); % use uitab to display data
ef1 = uitable(uit1,"Data",mud1);
uit2 = uitab(tg,'Title','Clastpoor');
ef2 = uitable(uit2,"Data",clastpoor);
uit3 = uitab(tg,'Title','Diato');
ef3 = uitable(uit3,"Data",diatomooze);
uit4 = uitab(tg,'Title','Mudstone');
ef4 = uitable(uit4,"Data",mudstoneanddiatom);
uit5 = uitab(tg,'Title','Silt');
ef5 = uitable(uit5,"Data",siltstoneandmudstone);
uit6 = uitab(tg,'Title','Mud');
ef6 = uitable(uit6,"Data",mud);
uit7 = uitab(tg,'Title','Sand');
ef7 = uitable(uit7,"Data",sand);
0 comentarios
Ver también
Categorías
Más información sobre Speech Recognition en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!