How to create separate tables so that I can have them open at the same time?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Ganesh Gudipati
2022-4-12
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!