How to create separate tables so that I can have them open at the same time?

1 回表示 (過去 30 日間)
Jacob Allen
Jacob Allen 2022 年 4 月 7 日
回答済み: Ganesh Gudipati 2022 年 4 月 12 日
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};

回答 (1 件)

Ganesh Gudipati
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.
For more information refer uitable and figure .

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by