Effacer les filtres
Effacer les filtres

Create a static text box that displays a number, then adds one every time the GUI is opened.

1 vue (au cours des 30 derniers jours)
I am trying to create a static text box that displays the value 'R0000001'. Then from that point on, every time the GUI opens or the "New" option from the tool bar is clicked the static text box displays the next value up.
For example when I open the GUI for the first time the static text box displays 'R0000001'. Then I choose "New" it will display 'R0000002'.After that I close it and reopen it again it will display "R0000003' ... and so on.
This GUI will be compiled to be a standalone application to be used by users that do not have MATLAB installed.
Is this possible?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 23 Mai 2013
In your opening function
s=char(get(handles.text1,'string'));
n=num2str(str2num(s(2:end))+1);
s(end-numel(n)+1:end)=n
set(handles.text1,'string',s)
  3 commentaires
Azzi Abdelmalek
Azzi Abdelmalek le 23 Mai 2013
No, use a mat-file
In windows command, create a mat-file
s='R0000001'
save filename s
In your opening function
s=load('filename');
s=s.s
n=num2str(str2num(s(2:end))+1);
s(end-numel(n)+1:end)=n
set(handles.text1,'string',s)
save filename s

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming Utilities dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by