필터 지우기
필터 지우기

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

조회 수: 3 (최근 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 CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by