Filter löschen
Filter löschen

Is there anyway to automatically open up a tab that was just generated?

2 Ansichten (letzte 30 Tage)
I have been working on a code for awhile now that automatically imports a large number of .csv files, decides which curve fit is the best option, and then integrates that function and plots both the fitted curve and its integral in a tab. As it goes down my list of files, it creates a new tab for each file (each with the plots of the fitted curve and integral).
From a purely aesthetic point of view, I would really like it if every time a new tab was created, the gui automatically opened that one. Because, currently, while the program is running (and it can take about 5 minutes), it stays open only on the first tab, as each new tab slowly pops into existence. (Don't worry, I have a wait bar so that the user knows not to touch anything!)
But is that possible? Is it possible to have the GUI automatically open up a tab that was just created?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 8 Apr. 2016
If tabgp is your uitabgroup and tabh is your newly created tab, then
set(tabgp, 'SelectedTab', tabh);
drawnow();

Weitere Antworten (1)

Adam
Adam am 8 Apr. 2016
Bearbeitet: Adam am 8 Apr. 2016
hTabGroup.SelectedTab = hUiTab;
will programmatically set the current tab, assuming hTabGroup is your uitabgroup and hUiTab is the handle of the uitab object you have just created.
I don't think the GUI can react to the creation of a tab, as such, but you can manually set the tab like this immediately after creating your new tab.
Note: This syntax works from R2014b onwards. For earlier releases you need to use Walter's syntax (which will also still work in later versions)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by